We know that a perfect square has the form
(x+y)^2 = x^2+2xy+y^2
If we substitute the numbers in the given equation, we have
(x+y)^2 = x^2+2xy+y^2 = x^2+2x(9) + y^2
By comparison of the coefficients of the term xy, we have y=9, hence we need y^2=9^2=81 to complete the square.
The completed square would be
(x+9)^2-81=0 (which expands back to x^2+18x=0)
However, if the objective is to solve the equation, I would solve it by factoring, i.e.
x^2+18x=0 => x(x+18)=0 => x=0 or x=-18