Show that $G$ is cyclic if $G$ has at most two proper subgroup
First of all it is not a duplicate I know there is an answer here: If $G$ has only 2 proper, non-trivial subgroups then $G$ is cyclic
However, I did not understand the answer. So I will write my attempt.
My Attempt:
$\underline{\text{Case 1 : } \vert G\vert=pq, \text{where p and q are primes}}$
$\vert H\vert$ divides $pq$ and $\vert K\vert$ divides $pq$ by Lagrange Theorem. By assumption these subgroups are unique. Thus G is cyclic. Since there is at most four subgroups with orders $1, p,q,pq$.
$\underline{\text{Case 2 : } \vert G\vert=p^2, \text{where p is prime}}$
Again Lagrange implies only three subgroups of order $1,p,p^2$. A contradiction! So, in $pq$ we can assume $p \neq q$
$\underline{\text{Case 3 : } \vert G\vert=n, \text{where n is composite}}$
Since $n$ is composite we can write $n=mk$, where $1<m,k<n$. Again by Lagrange Theorem we have:
$$\vert H \vert \text{ divides } m\cdot k \text{ and } \vert K\vert \text{ divides } m\cdot k$$
These are only subgroups. Hence this implies $m$ and $k$ must be prime. Otherwise, some subgroup of order $l$, where $l$ divides $m\cdot k$. But this means we have more then $2$ subgroups. This means $n=pq$ with $p \neq q$.
Are there any mistake?
The arguments are in right direction but they don't look precise. For example in case 1, what if both $|H|=|K| = p$? In case 2, I don't think the fundamental theorem even applies if there are two subgroups of order $p$. A better way will be to prove the contrapositive i.e. if the group is not cyclic then there are $3$ or more proper subgroups.
So choose $a\in G$. Consider cyclic group $\langle a\rangle$. Since $G$ is not cyclic, there is $b\in G$ such that $b\notin \langle a\rangle$. Here you get your 2nd proper subgroup $\langle b\rangle$. Now you have to produce 3rd one. If the order of $a$ (or $b$) is composite then you get the third proper subgroup as a subgroup of $\langle a\rangle$ (or $\langle b\rangle$). So assume that the order of both of them is prime. We claim that $\exists$ $c\in G$, $c \notin \langle a\rangle \cup \langle b\rangle$ which gives us our 3rd proper subgroup $\langle c\rangle$. If not then we have $\langle a\rangle \cup \langle b\rangle = G$. There are two cases.
Case (1) if the orders of both $a$ and $b$ equal to the same prime $p$ then group order is $2p - 1$ and $p$ dividing $2p - 1$ is not possible.
Case (2) if the orders are distinct primes $p \not= q$ then group order is $p + q -1$. Then $p$ divides $q -1$ and $q$ divides $p-1$ which is impossible.
Thus our claim must be true.
Note : Argument in both the cases assume that $\langle a\rangle$ and $\langle b\rangle$ share no common element other than the identity. But this is easy to see using that every non identity element in a cyclic group of prime order is a generator.