This exercise if from Beachy and Blairs Abtract algebra book.
Assume that $p$ and $q$ are primes.
Show that: $pq+1$ is square $\iff$ $p$ and $q$ are twin primes.
The backward direction is: Assume that $$p=q+2$$ then $$pq+1=q^2+2q+1=(q+1)^2.$$
For the forward direction: we assume that $$pq+1$$ is a square that is $$pq+1=n^2\Rightarrow pq=(n-1)(n+1).$$ Now since $p$ and $q$ are primes by assumption and prime factorisation is unique we have $$p=n-1\qquad q=n+1$$ so $p$ and $q$ are two apart therefore are twins.
First of all in my original question I forgot a really important assumtion that both of $p$ and $q$ are primes from the beginning. I am sorry for this mistake. So some of the comments may be irrelevant now when I edited the question (I hope it is correct now). Thanks for the comments and again sorry for the incorrect citation of the question.
Yes, you are missing somethin, in fact your proof is wrong on at least two points.
First of all, you need to assume that $p$ and $q$ are primes for the forward direction to even work, since otherwise, you could have $p=6$ and $q=4$ to get $pq+1=25=5^2$.
Second of all, you go from
$$pq=(n+1)(n-1)$$ straight to "therefore, $p$ and $q$ are two appart, which is faulty logic since you assume $$ab=cd \implies \{a,b\}=\{c,d\}$$ which is false in general. For example, $3\cdot 8 = (5+1)(5-1)$, however that does not mean that $\{3,8\}=\{4,6\}$. Of course, if you know that $a$ and $b$ are primes, then it is possible to show this, but still, you can't just assume it is true.
After the edit:
Your proof is now correct. Using the unique factorisation is a quick and easy way to prove the statement, and it's also clear why you need to assume $p,q$ are primes (and how $4,6$ fails in that step).