Let $\pi:\mathcal{X} \to S$ be a flat, family of projective varieties (here $\mathcal{X}$ and $S$ are noetherian). Let $E$ and $F$ be two locally free sheaves on $\mathcal{X}$ such that for all $s \in S$, $E_s \cong F_s$, where $E_s$ and $F_s$ are the restriction of $E$ and $F$ respectively to the fiber $\mathcal{X}_s$ over $s$ of $\pi$. Then, does there exists an invertible sheaf $L$ on $S$ such that $E \cong F \otimes \pi^*L$?

4$\begingroup$ No. If $E$ and $F$ are $\pi$pullbacks of respective vector bundles $V$ and $W$ of the same constant rank on $S$ then the hypothesis holds and you're seeking a line bundle $L$ on $S$ so that $V$ and $W \otimes L$ have isomorphic $\pi$pullbacks, which generally fails when $\pi$ admits a section (extreme case: $\mathcal{X}=S$!). $\endgroup$ – nfdc23 Aug 29 '17 at 14:13

1$\begingroup$ @nfdc23 But this is true in the case $E$ and $F$ are line bundles as seen in Hartshorne's "Algebraic geometry" Ex. III.12.4. Ofcourse the proof does not hold for higher rank. $\endgroup$ – Jana Aug 29 '17 at 14:17

1$\begingroup$ Sure, but the special case of line bundles doesn't provide a good guide to what to expect for higherrank cases. Is there some motivation for your question, or is it idle curiosity after seeing the rank1 case in Hartshorne's book? $\endgroup$ – nfdc23 Aug 29 '17 at 14:25

$\begingroup$ @nfdc23 It was mainly curiosity. I was mainly interested in the case $\pi$ is a family of rational curves. I am guessing that vector bundles on such families might split into line bundles (I have asked this question seperately on mathoverflow). Then, may be use some kind of uniqueness of decomposition argument to prove a similar result in this case. Not sure though, if any of it might work. $\endgroup$ – Jana Aug 29 '17 at 14:34
As @nfdc23 points out, even in the simplest case of $\pi=\mathrm{id}_X$ your suggestion would amount to saying that for any two locally free sheaves of the same rank (at every point) there would be a line bundle that twists one to the other. Obviously this fails.
On the other hand if one approaches the problem a little differently, then one can get a reasonable statement which generalizes the one that motivated you to ask.
The essential case in the statement you quote is the following:
Let $\pi:X \to S$ be a flat family of projective varieties and $\mathscr L$ a line bundle on $X$ such that for all $s \in S$, $\mathscr L_s \simeq \mathscr O_{X_s}$. Then there exists an invertible sheaf $\mathscr N$ on $S$ such that $\mathscr L \simeq \pi^*\mathscr N$.
Then the statement you are quoting is a simple application of this for $\mathscr L\otimes \mathscr M^{1}$.
Now, if you think about it, the above statement is actually true for arbitrary locally free sheaves:
Let $\pi:X \to S$ be a flat family of projective varieties and $\mathscr E$ a locally free sheaf of constant rank $q$ on $X$ such that for all $s \in S$, $\mathscr E_s \simeq \mathscr O_{X_s}^{\oplus q}$. Then there exists a rank $q$ locally free sheaf $\mathscr G$ on $S$ such that $\mathscr E \simeq \pi^*\mathscr G$.
Proof: I claim that the same proof works. Indeed by the assumption, $h^0(X_s, \mathscr E_s)$ is constant, in fact equal to $q$, so $\mathscr G:=\pi_*\mathscr E$ is locally free of rank $q$ on $S$. Next we observe that by the assumption, the natural morphism $$ \alpha: \pi^*\pi_*\mathscr E\longrightarrow \mathscr E $$ is surjective. Since these are locally free sheaves of the same constant rank, this can only happen if $\alpha$ is an isomorphism. $\square$
Edit: Apparently, what I originally claimed as a conclusion was a little too much to hope for (thanks to Piotr to point that out!). I guess then the above is the best statement, but it still reduces to the original in case $r=1$, so it can still be considered a direct generalization.

$\begingroup$ Confused about the last statement: if $S$ is a point and $E=F$, you seem to claim that $\mathcal{E}nd(E)$ is trivial of rank ${\rm rk}(E)^2$. But this is false already for $E=\mathcal{O}\oplus\mathcal{O}(1)$ on $\mathbb{P}^1$. $\endgroup$ – Piotr Achinger Aug 30 '17 at 8:58

$\begingroup$ @SandorKovacs Thanks a lot for the detailed answer. $\endgroup$ – Jana Aug 30 '17 at 13:39

$\begingroup$ @PiotrAchinger: Oops, you're right. I was a little careless with that... $\endgroup$ – Sándor Kovács Aug 30 '17 at 17:34