This problem comes from a Grade 11 math textbook in a section on solving quadratic functions by factoring. What follows is my attempt at a solution.
A right triangle has one leg, $n$ and a hypotenuse, $2n+6$. The challenge is to determine the lengths of all the sides, given that the perimeter is $60$.
I worked through this problem a few times with a student. Finally I suggested we step away from it. I decided to post it to this forum for everyone's feedback. As I progressed through the problem, a strange thing happened -- a solution emerged. As is often the case, slowing down and meticulously formulating a question is all that is needed to find a solution.
Rather than include my attempt in the question body, I've added it as a solution below.
Let's correct your solution. Following your notation, the other leg will have length $x$. Since the perimeter is $60$, \begin{align*} x + n + 2n + 6 & = 60\\ x + 3n + 6 & = 60\\ x & = 54 - 3n \end{align*} By the Pythagorean Theorem, \begin{align*} x^2 + n^2 & = (2n + 6)^2\\ x^2 + n^2 & = 4(n + 3)^2\\ x^2 + n^2 & = 4(n^2 + 6n + 9)\\ x^2 + n^2 & = 4n^2 + 24n + 36\\ x^2 & = 3n^2 + 24n + 36\\ x^2 & =3(n^2 + 8n + 12) \end{align*} On the other hand, we know that \begin{align*} x^2 & = (54 - 3n)^2\\ x^2 & = 9(18 - n)^2\\ x^2 & = 9(324 - 36n + n^2)\\ \end{align*} Hence, \begin{align*} 3(n^2 + 8n + 12) & = 9(n^2 - 36n + 324)\\ n^2 + 8n + 12 & = 3(n^2 - 36n + 324)\\ n^2 + 8n + 12 & = 3n^2 - 108n + 972\\ 0 & = 2n^2 - 116n + 960\\ 0 & = n^2 - 58n + 480\\ 0 & = (n - 10)(n - 48) \end{align*} giving $n = 10$ and $n = 48$ as possible solutions.
If $n = 10$, then $2n + 6 = 26$, and $x = 54 - 3n = 24$. As you can check, $(10, 24, 26)$ is a Pythagorean triple.
If $n = 48$, then $2n + 6 = 102$, and $x = 54 - 3n = -90$. Since a side length cannot be negative, we reject this solution.
You confused the roles of $x$ and $n$, which led you astray.