At this level, one should be more explicit about how the contradiction is obtained, i.e. the final equation contradicts the hypothesis that $n$ is a perfect square. That done the proof is correct.
The proof essentially repeats inline the below Bezout-based proof of Euclid's Lemma (for $\,k = p)$. Generally it is better to invoke the Lemma by name (Euclid's Lemma) rather than repeat its proof inline, i.e. in your proof you could write $\,\gcd(\color{#0a0}{q,p})=1,\ \color{#0a0}{q\mid p}\cdot\color{#c00}p \,\Rightarrow\, q\mid\color{#c00} p\,$ by Euclid's Lemma.
Euclid's Lemma $\ \gcd(p,q) = 1,\,\ q\mid p k\,\Rightarrow\, q\mid k$
Proof $\,\ q\mid pk,qk\, \Rightarrow\, q\mid (ap\!+\!bq)k = k,\,$ where $\,ap\!+\!bq = 1\,$ by Bezout.
Remark $ $ See here for a simple Bezout based proof that generalizes to higher-degree roots and arbitrary algebraic integers {i.e. monic case [lead coeff $=1]$ of Rational Root Test). It uses Bezout to reduce the degree of the monic polynomial of which the number is a root, so we eventually reach a linear monic $\,x - n,\,$ so $\,x = n\,$ is an integer.