I am linear interpolating two points $(x_0, f_0)$ and $(x_1, f_1)$.
Using Taylor Expansion.
$$f(x_0+\Delta x) = f(x_0) + f'(x_0) \Delta x + \frac{1}{2!} f''(x_0) (\Delta x)^2+\cdots$$
In the textbook, it is given that
$$f(x) = f_i+\frac{x-x_{i}}{x_{i+1}-x_i}(f_{i+1}-f_i)+\Delta f(x)$$
where
$$\Delta f(x)=\frac{\gamma}{2}(x-x_{i})(x-x_{i+1}),$$
and
$\gamma=f^{\prime\prime}(a),$ ${\mathrm{with}}\ a\in[x_{i},x_{i+1}],$
On comparing the equation given in the textbook and the Taylor expansion term (Neglecting the higher-order terms). I can't follow how the error term came in the textbook.
Just to start, I'm not sure that direct comparison between the Taylor expansion of $f$ and the linear interpolant to $f$ is an instructive way to understand the error term in the interpolation.
To get that error term, let
\begin{equation*} p_{1}(x) = f_{i} + \frac{x-x_{i}}{x_{i+1}-x_{i}}(f_{i+1}-f_{i}) \end{equation*}
be the linear interpolation under consideration.
If $x = x_{i}$ or $x = x_{i+1}$, the result is trivial. Otherwise, suppose $x\in (x_{i},x_{i+1})$. At this $x$, consider the function $t\mapsto \varphi(t)$ on $[x_{i},x_{i+1}]$ defined by
\begin{equation*} \varphi(t) = f(t) - p_{1}(t) - \frac{f(x)-p_{1}(x)}{(x-x_{i})(x-x_{i+1})}(t-x_{i})(t-x_{i+1}). \end{equation*}
We see that $\varphi(x_{i}) = \varphi(x_{i+1}) = 0$ and that $\varphi(x) = 0$. Thus, $\varphi$ vanishes at $3$ points which are distinct in $[x_{i},x_{i+1}]$. Consequently, by Rolle's Theorem, $\varphi'(t)$ (the first derivative of $\varphi$ with respect to $t$) vanishes at $2$ points in $(x_{i},x_{i+1})$, one between each consecutive pair of points at which $\varphi$ vanishes. Applying Rolle's Theorem again shows that $\varphi''$ vanishes at a point in $a\in (x_{i},x_{i+1})$. Now differentiating twice (and noting that $p_{1}''$ vanishes everywhere), we have that
\begin{equation*} 0 = \varphi''(a) = f''(a) - \frac{f(x)-p_{1}(x)}{(x-x_{i})(x-x_{i+1})}\cdot 2 \end{equation*}
and so
\begin{equation*} f(x) = p_{1}(x) + \frac{f''(a)}{2}(x-x_{i})(x-x_{i+1}) \end{equation*}