This problem is asked quite often; I want to check whether my approach is right.
Let $ p = 4k+1 $ be prime. Then there exists integer $n$ such that
$ n^2 \equiv -1$ (mod $p $) .
Approach : By Fermat's Little Theorem ,
$ n^{4k}\equiv 1 $ (mod p )
$ => (n^{2k}-1)(n^{2k}+1) \equiv 0 $
$=> (n^{2k}+1) \equiv 0 . $
As $ n^{4k}-1\equiv 0 $ (mod p ).
=> $n^{2k}+1 \equiv 0 $
=>$ (n^k)^2 +1 \equiv 0 $ ( mod p) .
Is this right ?
As pointed out in comments, the implications in your attempted proof are not legitimate.
Try this. Let $a$ be a primitive root modulo the prime $p.$ Then can you show, using Fermat’s Little Theorem, that $n=a^k,$ where $p=4k+1,$ is a solution to $n^2 \equiv -1 \pmod p?$