Let $\eta:G\to G$ be the map that sends $g\to g^2$. Since $G$ is abelian, $\eta$ is indeed a morphism of groups: $\eta(ab)=(ab)^2=abab=aabb=a^2b^2=\eta a\;\eta b$. This means in particular that ${\rm im}\, \eta=\{g^2:g\in G\}=H$ is a subgroup of $G$, so $\eta':G\to H={\rm im}\, \eta$ with $g\mapsto g^2$ is onto.
It's kernel is $\{g\in G:g^2=1\}=K$ which is, since $\eta$ is a morphism of groups, a normal subgroup of $G$.
More generally, if $G$ is abelian $\mu_p:G\to G$ with $g\to g^p$ is a morphism of groups with image $G^p=\{g^p:g\in G\}$ and kernel $G[p]=\{g\in G:g^p=1\}$. One will see the notation $G(p)=\bigcup\limits_{n\geqslant 1}G[p^n]$. When $p$ is prime, $G(p)$ is called the $p$-primary component of $G$, and it is a theorem that $G=\bigoplus G(p)$ as $p$ runs through the prime divisors of $|G|$, for $G$ finite.