As mentioned previously, the implication as you interpreted it is incorrect. $k\mid (n-1)!$ does not imply that $k\equiv 1\pmod{n}$. Take any counterexample you like, such as $k=3,n=5$.
Here I hope to go over some of the details of that section of the proof in the attempt to clarify some of the points.
Suppose that $(n-1)!\equiv -1\pmod{n}$
We argue that $n$ must be prime. To accomplish this, suppose to the contrary that $n$ is in fact composite. In this case, $n=km$ for some $k,m\in\mathbb{N}\setminus\{1\}$ implying that $k<n$.
In this case, $k$ must then be equal to one of $\{2,3,4,\dots,n-2,n-1\}$. This implies that $k\mid (n-1)!$ since $(n-1)!=\prod\limits_{i=1}^{n-1} i = k\prod\limits_{i=1~~~i\neq k}^{n-1} i$.
However, since $(n-1)!\equiv -1\pmod{n}$ and $k\mid n$ and $k\mid (n-1)!$, all of these things together imply that $k\equiv 1\pmod{n}$
Why? Since $k\mid n$ and $k\mid (n-1)!$, you have that $k\mid \gcd((n-1)!,n)$, but since $(n-1)!\equiv -1\pmod{n}$ that implies that $(n-1)!$ is coprime to $n$ (since this implies there is some multiple of $n$ which is exactly one away from $(n-1)!$). Therefore $\gcd((n-1)!,n)=1$ and so $k\mid 1$. This is, however, a contradiction since we said that $k\in\mathbb{N}\setminus \{1\}$.