Hint $\,\ k\mid n^2\!\iff\! k\mid n\,\ $ is true $\iff k\,$ is squarefree (see there for many characterizations)
For if $\,k\,$ is not squarefree then $\, k = ab^2,\,\ b\nmid 1,\,$ hence $\,k\mid (ab)^2\,$ but $\,k\nmid ab\,$ (else $\,b\mid 1).$
Conversely if $\,k\,$ is squarefree then every prime $\,p_i\,$ in the unique prime factorization of $\,k\,$ occurs to the power $\,1.\,$ By Euclid's Lemma $\,p_i\mid k\mid n^2\,\Rightarrow\,p_i\mid n,\,$ therefore $\,k = {\rm lcm}\{\,p_i\}\mid n,\,$ by existence & uniqueness of prime factorizations (or by lcm = product for coprimes)