Groups $G,H$ with surjective homomorphisms that are quotient of each other Let $G$ and $H$ be groups and assume that there exist onto homomorphisms
$$\phi :G\rightarrow H,\qquad\psi :H\rightarrow G.$$
If $H$ and $G$ are finite then it is clear that $H$ and $G$ are isomorphic.
It is also valid for finitly generated abelian groups.
However, in general this is not true even in the abelian case.

My question is: if we know that $G,H$ are finitly generated and such $\phi ,\psi$ exist then are $G$ and $H$ isomorphic?

 A: There is an example of two non-isomorphic groups with this property in Theorem 3 of the paper by Baumslag and Solitar on non-Hopfian groups, whcih you can access here.
The two groups are $\langle a,b \mid a^{-1}b^2a=b^3 \rangle$ and $\langle c,d \mid c^{-1}d^2c=d^3, ([c,d]^2c^{-1})^2=1 \rangle$.
A: As already answered, any example has to be a non-Hopfian group, and there are easy examples that are abelian (and infinitely generated) and some more subtle (but widely studied) finitely generated examples, as in Derek's answer.
However the given property ($\ast$) is weaker than hopfian, where Property ($\ast$) for a group $G$ is defined as: whenever $H$ is a quotient of $G$ admitting $G$ as a quotient, then $H$ is isomorphic to $G$.
Of course Hopfian implies ($\ast$), but the converse fails: for instance, if $C(p^\infty)$ is the Pr\"ufer group and $G=C(p^\infty)^{\mathbf{N}}$ is the direct sum of countably many copies of $C(p^\infty)$, then the abelian group $G$ is clearly non-Hopfian but satisfies ($\ast$).
For a finitely generated example, consider the group $A_n$ of $n\times n$ upper triangular matrices over $\mathbf{Z}[1/p]$ ($p$ prime) with $a_{11}=a_{nn}=1$, and $B_n$ the quotient of $A_n$ by the (central) cyclic subgroup generated by the elementary matrix $e_{1n}(1)$. Then $B_n$ is finitely generated for $n\ge 3$; (it was introduced by Hall for $n=3$ and Abels for $n\ge 4$, in which case it is finitely presented) is non-Hopfian. But it satisfies ($\ast$) by a simple argument.
However this seems quite exceptional and "most" non-Hopfian groups ought not to satisfy ($\ast$).
A: In the paper:
A. V. Borshchev and D. I. Moldavanskii, On the isomorphism of some groups
 with one defining relation, Mat. Zametki 79 (2006), no. 1, 34–44. MR 2252133,
the authors construct non-isomorphic two generator, one-relator groups $G=\langle X; R\rangle$ and $H=\langle Y; S\rangle$ such that $G\twoheadrightarrow H$ and $H\twoheadrightarrow G$. These examples are surprising as, from the point of view of presentations, they are the simplest possible.
