I've just read from An introduction to the theory of groups from Rotman's the following theorem:
Theorem 2.19. Let $p$ be a prime. A group $G$ of order $p^n$ is cyclic if and only if it is an abelian group having a unique subgroup of order $p$.
Proof Necessity follows at once from Lemma 2.15. For the converse, let $a \in G$ have largest order, say $p^k$ (it follows that $g^{p^k} = 1$ for all $g \in G$). Of course, the unique subgroup $H$ of order $p$ is a subgroup of $\langle a\rangle$. If $\langle a\rangle$ is a proper subgroup of $G$, then there is $x \in G$ with $x \not \in \langle a\rangle$ but with $x^p \in \langle a\rangle$; let $x^p = a^l$. If $k = 1$, then $x^p = 1$ and $x \in H \subset \langle a\rangle$, a contradiction; we may, therefore, assume that $k>1$. Now $$1 = x^{p^k}=(x^p)^{p^{k-1}}=a^{lp^{k-1}},$$ so that $l = pm$ for some integer $m$, by Exercise 2.13. Hence, $x^p = a^{mp}$, and so $1 = x^{-p}a^{mp}$. Since $G$ is abelian, $x^{-p}a^{mp} = (x^{-1}a^m)^p$, and so $x^{-1}a^m \in H \subset \langle a\rangle$. This gives $x \in \langle a\rangle$, a contradiction. Therefore, $G = \langle a\rangle$ and hence is cyclic.
As usual, there is some trivial part of the proof which I don't understand: I don't see why "If $\langle a\rangle$ is a proper subgroup of $G$, then there is $x \in G$ with $x \not \in \langle a\rangle$ but with $x^p \in \langle a\rangle$", I understand the rest of the proof. I would appreciate if someone could explain to me that statement.
Clearly, $\langle a\rangle$ being proper means there is $x\in G\setminus \langle a\rangle$. Now, there is $p^n$ such that $x^{p^n}=1\in \langle a \rangle$. In particular, there is $n$ such that $x^{p^{n-1}}\notin \langle a\rangle $ but $x^{p^n}\in \langle a\rangle$. Indeed, if $x^p\in \langle a\rangle$, we're done. Else $x^p \notin \langle a \rangle$. Now take $x'=x^p$. If $x'^p= x^{p^2}\in \langle a\rangle $ we're done. Eventually we reach $n$ such that $x^{p^n}=1$, so the process furnishes some "good" $x^{(n)}$ for some $n\geqslant 0$.