Let $L_1$ and $L_2$ be two line bundles on a complex smooth variety $X$. Suppose $L_1$ and $L_2$ have the same fibers on $X$ except on a prime divisor $D$ of $X$. How to prove that $$L_1 \cong L_2 \otimes \mathcal{O}_X(nD)$$ for some integer $n$?
Let $D_1$ and $D_2$ be the divisors corresponding to $(L_1,s_1)$ and $(L_2,s_2)$, where $s_1$ and $s_2$ are two nonzero rational sections of $L_1$ and $L_2$ respectively. The statement above is equivalent to $$D_1 - D_2 = nD.$$ It suffices to show $$\text{div} \left(\frac{s_1}{s_2}\right) = \text{ord}_D \left(\frac{s_1}{s_2}\right).$$ But I'm not sure why there cannot be contribution from any other prime divisor $Z \neq D$.