Let $G$ be a group and let $\varphi \in \operatorname{End}(G)$ be such that there exists $n\geq 0$ such that $\ker (\varphi ^n)=G$.
Prove that if $\ker \varphi$ is finite or $[G:\operatorname{Im}\varphi ]$ is finite then $G$ is finite.
My attempt:
WLOG we can let $n$ be the smallest non-negative integer such that $\ker \varphi =G$. Then it is clear that $\ker \varphi ^k\lhd \ker \varphi ^{k+1}$ for $0\leq k<n$, hence $1,\ker \varphi ,\ker \varphi ^2,\ldots ,\ker \varphi ^{n-1},G$ is a normal series of $G$. I also proved that $\operatorname{Im}(\varphi ^{n-1})<\ker \varphi$, hence $\varphi ^{n-1}(G)$ is finite.
But I don't know how to use the hypothesis of $\ker \varphi$ being finite to prove that $G$ is finite (maybe we can show that if $\operatorname{Im}(\varphi ^k)$ is finite then $\operatorname{Im}(\varphi ^{k-1})$ is finite).
I also believe that I should prove that $[G:\operatorname{Im}\varphi ]$ is finite, then $\ker \varphi$ is finite and finish using the result above.
Assume that $\varphi$ has finite kernel. Consider the map $\varphi:\ker(\varphi^{k+1}) \rightarrow \ker(\varphi^k)$. It has finite kernel. So if it has finite range, it has finite domain. By induction, if $\ker(\varphi)$ is finite, so is every $\ker(\varphi^n)$ and in particular $G$.
If the image of $\varphi$ has finite index, then $\varphi^k(\varphi(G))$ has finite index in $\varphi^{k}(G)$ for all $k$. It follows that $1=\varphi^n(G)$ has finite index in $G$ so that $G$ is finite.