Let $X$ be a smooth projective variety, and $D$ a Cartier divisor on $X$ inducing a surjective morphism $f\colon X\rightarrow C$, where $C$ is a curve.
May we conclude that $D^{2}=0$?
The answer is yes if the complete linear system $|D|$ is without fixed components. In such a situation, the fact that $f$ is a morphism onto a curve implies that $|D|$ is composed with a base-point free rational pencil, hence $D^2=0$.
On the other hand, if there are fixed components the answer is in general no. In fact, take as $X$ the Hirzebruch surface $\mathbb{F}_n=\mathbb{P}(\mathcal{O}_{\mathbb{P}^1} \oplus \mathcal{O}_{\mathbb{P}^1}(-n))$, where $n \geq 3$, endowed with the fibration $\pi \colon X \to \mathbb{P}^1$. Let $f$ be a fibre of $\pi$ and $C_0$ the unique section such that $(C_0)^2=-n$, and set $D:=C_0+f$. Since $$D C_0 = (C_0+f)C_0=-n+1 <0,$$ it follows that $C_0$ is the fixed component of $|D|$, in other words $|D|=C_0+|f|$.
Then the map induced by $D$ is the same as the map induced by $f$, which in turn is $\pi \colon X \to \mathbb{P}^1$. On the other hand, we have $$D^2 = (C_0)^2 + 2 C_0f = -n + 2 <0.$$