The group $$\langle a, b, x, y\mid [a, b]^2=[x, y]^2\rangle$$$$G=\langle a, b, x, y\mid [a, b]^2=[x, y]^2\rangle$$ is a torsion-free group which is not free by cyclic. However, but contains$G$ is free-by-$D_{\infty}$ and so virtually free-by-cyclic (containing an index-two subgroup which is free-by-cyclic).
This example is from the paper Baumslag, Fine, Miller and Troeger, Virtual properties of cyclically pinched one-relator groups. Int. J. Alg. Comp. (2009).
- Firstly, it$G$ is torsion-free as it is a free product with amalgamation of two torsion-free groups.
- Secondly, it$G$ is not free-by-cyclic. Both $[a, b]$ and $[x, y]$ are contained in the commutator subgroup. These elements are non-equal but their squares are equal. Hence, the commutator subgroup does not have unique roots, and so it not free. Hence, any map to $\mathbb{Z}$ has non-free kernel.
- Finally, that group$G$ is free-by-cyclic follows from$D_{\infty}$ by Theorem 4 of the above-mentioned paper. The idea of the proof is to map $G$ onto the infinite dihedral group $\langle c, d\mid c^2=1, c^{-1}dc=d^{-1}\rangle$$D_{\infty}=\langle c, d\mid c^2=1, c^{-1}dc=d^{-1}\rangle$ by $\phi(a)=c=\phi(x)$ and $\phi(b)=d=\phi(y)$, and then prove that $\phi$ has free kernel. The index-two subgroup $\phi^{-1}(d)$ of $G$ is therefore free-by-cyclic.