Since $f:G\to \Z$ is surjective, there exists an element $a\in G$ such that
\[f(a)=1.\]
Let $H=\langle a \rangle$ be the subgroup of $G$ generated by the element $a$.

We show that $G\cong \ker(f)\times H$.
To prove this isomorphism, it suffices to prove the following three conditions.

The subgroups $\ker(f)$ and $H$ are normal in $G$.

The intersection is trivial: $\ker(f) \cap H=\{e\}$, where $e$ is the identity element of $G$.

Every element of $G$ is a product of elements of $\ker(f)$ and $H$. That is, $G=\ker(f)H$.

The first condition follows immediately since the group $G$ is abelian, hence all the subgroups of $G$ are normal.

To check condition 2, let $x\in \ker(f) \cap H$.
Then $x=a^n$ for some $n\in \Z$ and we have
\begin{align*}
0&=f(x) && \text{since $x \in \ker(f)$}\\
&=f(a^n)\\
&=nf(a) && \text{since $f$ is a homomorphism.}\\
&=n &&\text{since $f(a)=1$}.
\end{align*}
Thus, as a result we have $x=a^0=e$, and hence $\ker(f) \cap H=\{e\}$.
So condition 2 is met.

To prove condition 3, let $b$ be an arbitrary element in $G$.
Let $n=f(b) \in \Z$. Then we have
\[f(b)=n=f(a^n),\]
and thus we have
\[f(ba^{-n})=0.\]
It follows that $ba^{-n}\in \ker(f)$.
So there exists $z\in \ker(f)$ such that $ba^{-n}=z$.
Therefore we have
\begin{align*}
b=za^n\in \ker(f)H.
\end{align*}
This implies that $G=\ker(f)H$.

We have proved all the conditions, hence we obtain
\[G\cong \ker(f)\times H.\]
Since $H$ is a cyclic group of infinite order, it is isomorphic to $\Z$.
(If $H$ has a finite order, then there exists a positive integer $n$ such that $a^n=e$. Then we have
\begin{align*}
0=f(e)=f(a^n)=nf(a)=n,
\end{align*}
and this contradicts the positivity of $n$.)

Combining these isomorphisms, we have
\[G\cong \ker(f)\times \Z,\]
as required.

Fundamental Theorem of Finitely Generated Abelian Groups and its application
In this post, we study the Fundamental Theorem of Finitely Generated Abelian Groups, and as an application we solve the following problem.
Problem.
Let $G$ be a finite abelian group of order $n$.
If $n$ is the product of distinct prime numbers, then prove that $G$ is isomorphic […]

Isomorphism Criterion of Semidirect Product of Groups
Let $A$, $B$ be groups. Let $\phi:B \to \Aut(A)$ be a group homomorphism.
The semidirect product $A \rtimes_{\phi} B$ with respect to $\phi$ is a group whose underlying set is $A \times B$ with group operation
\[(a_1, b_1)\cdot (a_2, b_2)=(a_1\phi(b_1)(a_2), b_1b_2),\]
where $a_i […]

Group Homomorphism, Preimage, and Product of Groups
Let $G, G'$ be groups and let $f:G \to G'$ be a group homomorphism.
Put $N=\ker(f)$. Then show that we have
\[f^{-1}(f(H))=HN.\]
Proof.
$(\subset)$ Take an arbitrary element $g\in f^{-1}(f(H))$. Then we have $f(g)\in f(H)$.
It follows that there exists $h\in H$ […]

A Group Homomorphism is Injective if and only if Monic
Let $f:G\to G'$ be a group homomorphism. We say that $f$ is monic whenever we have $fg_1=fg_2$, where $g_1:K\to G$ and $g_2:K \to G$ are group homomorphisms for some group $K$, we have $g_1=g_2$.
Then prove that a group homomorphism $f: G \to G'$ is injective if and only if it is […]

Abelian Normal subgroup, Quotient Group, and Automorphism Group
Let $G$ be a finite group and let $N$ be a normal abelian subgroup of $G$.
Let $\Aut(N)$ be the group of automorphisms of $G$.
Suppose that the orders of groups $G/N$ and $\Aut(N)$ are relatively prime.
Then prove that $N$ is contained in the center of […]

Group of $p$-Power Roots of 1 is Isomorphic to a Proper Quotient of Itself
Let $p$ be a prime number. Let
\[G=\{z\in \C \mid z^{p^n}=1\} \]
be the group of $p$-power roots of $1$ in $\C$.
Show that the map $\Psi:G\to G$ mapping $z$ to $z^p$ is a surjective homomorphism.
Also deduce from this that $G$ is isomorphic to a proper quotient of $G$ […]

Subgroup of Finite Index Contains a Normal Subgroup of Finite Index
Let $G$ be a group and let $H$ be a subgroup of finite index. Then show that there exists a normal subgroup $N$ of $G$ such that $N$ is of finite index in $G$ and $N\subset H$.
Proof.
The group $G$ acts on the set of left cosets $G/H$ by left multiplication.
Hence […]

Pullback Group of Two Group Homomorphisms into a Group
Let $G_1, G_1$, and $H$ be groups. Let $f_1: G_1 \to H$ and $f_2: G_2 \to H$ be group homomorphisms.
Define the subset $M$ of $G_1 \times G_2$ to be
\[M=\{(a_1, a_2) \in G_1\times G_2 \mid f_1(a_1)=f_2(a_2)\}.\]
Prove that $M$ is a subgroup of $G_1 \times G_2$.
[…]