Your teacher is correct. Because the rod has non-zero mass, tension will vary along the rod from $F$ at end A to $2F$ at end B.
If we consider a small element of the rod with length $\delta x$ and mass $\delta m$ then the difference $\delta T$ between the tensions acting to the right and to the left on that element $\delta m$ must be sufficient to accelerate it with an acceleration of $\frac F m$ which is the acceleration of the whole rod. So
$\displaystyle \delta T = \frac F m \delta m$
If we assume that the rod has the same cross sectional area $A$ and the same density $\rho$ along its whole length then
$\delta m = \rho A \delta x
\\ \displaystyle \Rightarrow \delta T = \frac F m \rho A \delta x$
But the whole mass of the rod $m$ is equal to $\rho A l$, so
$\displaystyle \delta T = \frac F l \delta x$
In the limit as $\delta T$ and $\delta x$ become small we have
$\displaystyle \frac {dT}{dx} = \frac F l$
and since $\frac F l$ is a constant, we can see that $T$ must vary linearly along the rod. We know that $T=F$ at end A and $T=2F$ at end B, so at a distance $x$ from end A we have
$\displaystyle T(x) = F + \frac F l x = F \left( \frac {l+x} l \right)$