Let $f$ be a convex differentiable function on $[x_1,\infty).$ Assume $x_2 > x_1.$ If
$$\lim_{x\to \infty} f'(x) = \frac{f(x_2)- f(x_1)}{x_2-x_1},$$
then on $[x_1,\infty),$ $f$ is the line through $(x_1,f(x_1))$ and $(x_2,f(x_2)).$
It is visible from the graph but how to write a formal proof.

I think the claim might not be true. What you can show is the following: By the mean value theorem $ \exists \xi \in ( x_{1} , x_{2} ) $ such that $ f'(\xi) = \frac{f(x_{2}) - f(x_{1})}{x_{2} - x_{1}} $. Additionally, we know that for any convex function, which is differentiable, the derivative is increasing. This implies that for $ x \ge \xi $, we have $ f '(x) = f(\xi) $. Otherwise, we obtain a contradiction to \begin{align*} f'(x) & \stackrel{x \to \infty}{\to} \frac{f(x_{2}) - f(x_{1})}{x_{2} - x_{1}} . \end{align*} This implies that for $ x \ge \xi $, $ f $ coincides with the line through $ (x_{1} , f(x_{1})) $ and $ ( x_{2} , f(x_{2}) ) $. In particular, $ f''(x) = 0 $ for any such $ x $. However, for values $ x < \xi $ the function does not have to coincide with this line. A counterexample might look somewhat like this: