Sanity check.
We have a surjective homomorphism φ: G → H. We know Ker φ ≅ ℤ and H ≅ ℤ. Then it follows G ≅ ℤ ⊕ ℤ, right?
No, that does not follow. It is true that G can be identified with the set $\displaystyle \mathbb{Z}\times\mathbb{Z}$, but the group operation can be different. In $\displaystyle \mathbb{Z}\times\mathbb{Z}$, the usual group operation is given by $\displaystyle (m,n)\oplus(p,q) = (m+p,n+q).$ But you can also define a group operation by $\displaystyle (m,n)\boxplus(p,q) = (m+(-1)^np,n+q).$ The homomorphism from $\displaystyle \mathbb{Z}\times\mathbb{Z}$ to $\displaystyle \mathbb{Z}$ is given in both cases by $\displaystyle \varphi(m,n) = n.$
In general, if $\displaystyle \phi:G\to H$ is a surjective homomorphism with kernel K, then G is (isomorphic to) a semidirect product of K and H. The above example is the semidirect product$\displaystyle \mathbb{Z}\rtimes_\alpha\mathbb{Z}$, where the action $\displaystyle \alpha$ of $\displaystyle \mathbb{Z}$ on itself comes from the automorphism $\displaystyle n\mapsto -n$ of the additive group $\displaystyle \mathbb{Z}.$
That's not right - you mean G is an extension of K by H (or H by K, I can never remember). It is an semidirect product if this extension splits.
An example of a group which is an extension of two groups H and K but is not a semidirect product of H with K is the group,
$\displaystyle G=\langle x, y, z; xy=yx, y^2=1, z^2=1, zxz=x^{-1}y, yz=zy\rangle$.
It contains a (normal) subgroup isomorphic to $\displaystyle \mathbb{Z}$ of finite index, so it is an extension of $\displaystyle \mathbb{Z}$ by a finite group. But it does not split. See here for an explanation as to why.
Ok, I got this response from another board and thought I'd copy it here:
In general if you have a surjective morphism G->H with kernel N, then G is a semidirect product of N and H, and it is not necessarily the direct product.
In your case where N and H are ℤ, the 2 elements of Aut(ℤ) (Id and -Id) give 2 possibilities : the first one is ℤ ⊕ ℤ, and the second one is a group generated by two elements a and b of infinite order with the relation b a b^-1 = a^-1.
However if you already know that G is commutative then it must be the direct product.
Again, this answer is not accurate! The first and last lines are wrong. Take, for example, $\displaystyle \mathbb{Z}$ under addition. Let $\displaystyle N=\langle n\rangle$ and let $\displaystyle H=C_n$, the cyclic group of order $\displaystyle n$.
It is an easy proof to show that $\displaystyle N$ is normal, and is isomorphic to $\displaystyle \mathbb{Z}$, and that if we quotient out by $\displaystyle N$ we get $\displaystyle H=C_n$. Thus, according to this answer, you have that $\displaystyle \mathbb{Z}$ is a semidirect product of $\displaystyle \mathbb{Z}$ and $\displaystyle C_n$. Therefore, $\displaystyle \mathbb{Z}$ contains a copy of $\displaystyle C_n$ (indeed, it must be $\displaystyle \mathbb{Z}\times C_n$ by the last line!). This is clearly false, as $\displaystyle \mathbb{Z}$ is torsion free (every element is a power of the generating element).
If you have two groups $\displaystyle N$ and $\displaystyle H$ and $\displaystyle G$ is another group such that $\displaystyle G/N\cong H$ then all that can be said is that $\displaystyle G$ is an extension of $\displaystyle H$ by $\displaystyle N$. For an extension to be a semidirect product you need it to split.