Exactly one nontrivial proper subgroup Question: Determine all the finite groups that have exactly one nontrivial proper subgroup.
MY attempt is that the order of group G has to be a positive nonprime integer n which has only one divisor since any divisor a of n will form a proper subgroup of order a. Since 4 is the only nonprime number that has only 1 divisor which is 2, All groups of order 4 has only 1 nontrivial proper subgroups (Z4 and D4)

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?
