Exactly one nontrivial proper subgroup

Let $H$ be the only non-trivial proper subgroup of the finite group $G$. Since $H$ is proper, there must exist an $x \notin H$. Now consider the subgroup $\langle x\rangle$ of $G$. This subgroup cannot be equal to $H$, nor is it trivial, hence $\langle x\rangle = G$, that is $G$ is cyclic, say of order $n$. The number of subgroups of a cyclic group of order $n$ equals the number of divisors of $n$. So $n$ must have three divisors. This can only be the case if $n$ is the square of a prime number. So, $G \cong C_{p^2}$.


You began reasonably, but then you went off the track. First, $D_4$ won’t work: it’s the Klein $4$-group, $(\Bbb Z/2\Bbb Z)\times(\Bbb Z/2\Bbb Z)$, which has three non-trivial proper subgroups, one generated by each of the non-identity elements.

Secondly, the fact that some integer $n$ divides the order of $G$ does not ensure that $G$ has a subgroup of order $d$, as noted in the comments. You do, however, have the first Sylow theorem available. (Note: This replaces the nonsense that I wrote originally.)

Finally, $4$ isn’t the only non-prime with only one non-trivial divisor: for each prime $p$, $p^2$ is such a number. You want at least the groups $\Bbb Z/p^2\Bbb Z$, or in your notation $\Bbb Z_{p^2}$, for all primes $p$. Can you identify exactly what the non-trivial proper subgroup is in each of these groups?


Hints/questions to consider: Have you done Sylow's theorem? How many Sylow subgroups can your group have? Show that your group must be cyclic- (hint for this: if not, all its element are in the unique proper subgroup). How many subgroups does a cyclic group of order $p^{n}$ have, when $p$ is prime and $n$ is a positive integer?