Such a group $G$ must have a unique minimal normal subgroup $M,$ which must itself be simple by the uniqueness of the composition series. If $G$ is a $p$-group, it follows by induction that $G$ is cyclic ($G/M$ is cyclic by induction, so $G$ is Abelian, and hence cyclic by the uniqueness of $M$). Suppose then that $G$ is not a $p$-group.
If $G$ is solvable, then it follows from the above ( and the uniqueness of the composition series) that $F(G)$ is a cyclic $p$-group. Then $G/F(G)$ is Abelian, hence cyclic of order $q^{m}$ for some prime $q \neq p$ (and in fact $q^{m}$ divides $p-1).$
Suppose then that $G$ is not solvable. Note that $G/G^{\prime}$ is a cyclic $p$-group for some prime $p,$ by the uniqueness of the composition series. More generally, $G/G^{(\infty )}$ has one of the structures above, where $G^{(\infty)}$ is the terminal member of the derived series of $G.$
We next describe the structure of $G^{(\infty)},$ so, for ease of exposition, we assume from now on that $G$ is perfect. Then since $F(G)$ is cyclic, we have $F(G) = Z(G)$, which is a (possibly trivial) cyclic $p$-group for some prime $p.$ Furthermore, $F(G)$ is the largest solvable normal subgroup of $G$.
Then, as above, $G/Z(G)$ has a unique minimal normal subgroup, which is non-Abelian simple, and has trivial centralizer. Using the Schreier conjecture, it follows that $G$ is quasi-simple in the case under consideration.
In summary, a general finite group $G$ with a unique composition series has one of the following structures:
$G$ may be a cyclic $p$-group for some prime $p.$
$F(G)$ may be a cyclic $p$-group, and $G$ is the semidirect product of $F(G)$ with a cyclic $q$-group for some prime $q \neq p.$
$G$ is not solvable, $F^{\ast}(G)$ is quasi-simple, and $Z(G)$ is a cyclic $p$-group for some prime $p.$ Furthermore, $G/F^{\ast}(G)$ is solvable with a unique composition series, so with one of the structures above (note also that $G/F^{\ast}(G)$ is a subgroup of the outer automorphism group of the simple group $F^{\ast}(G)/Z(G)$).
(Note that any group with any of these structures does indeed have a unique composition series).