You can rewrite your inequlities in terms of $ g ( x ) = f ( x ) - \frac { a + b } 2 $ and $ \epsilon = \frac { b - a } 2 $, and ask for the following:
If for some nonnegative real $ \epsilon $
$$ | g ( x + y ) - g ( x ) - g ( y ) | \le \epsilon \tag 0 \label 0 $$
for every real $ x $ and $ y $, is there an additive function $ A $ such that
$$ | g ( x ) - A ( x ) | \le \epsilon \tag 1 \label 1 $$
for all $ x $? Is such $ A $ unique? Does continuity of $ g $ imply linearity of $ A $?
The answers to all these questions are positive. In fact this notion is well-known and has a name: stability. A good reference for stability of many famous functional equations is Hyers-Ulam-Rassias stability of functional equations in nonlinear analysis by S.M. Jung. I give the proof on page 21 of that book, with some minor changes.
The trick is to define $ A ( x ) = \lim _ { n \to \infty } 2 ^ { - n } g ( 2 ^ n x ) $. To show that the limit exists for every $ x $, first note that by \eqref{0}, $ | g ( 2 x ) - 2 g ( x ) | \le \epsilon $, or equivalently $ \big| \frac 1 2 g ( x ) - g \big( \frac x 2 \big) \big| \le \frac \epsilon 2 $ for every $ x $. It follows that
$$ \left| 2 ^ { - n } g ( x ) - g \left( 2 ^ { - n } x \right) \right| = \left| \sum _ { i = 0 } ^ { n - 1 } \Big( 2 ^ { - n + i } g \big( 2 ^ { - i } x \big) - 2 ^ { - n + i + 1 } g \big( 2 ^ { - i - 1 } x \big) \Big) \right| \\
\le \sum _ { i = 0 } ^ { n - 1 } 2 ^ { - n + i + 1 } \big| 2 ^ { - 1 } g \big( 2 ^ { - i } x \big) - g \big( 2 ^ { - i - 1 } x \big) \big| \le \sum _ { i = 0 } ^ { n - 1 } 2 ^ { - n + i } \epsilon = ( 1 - 2 ^ { - n } ) \epsilon \text . \tag 2 \label 2 $$
Thus for $ m < n $ we get
$$ | 2 ^ { - m } g ( 2 ^ m x ) - 2 ^ { - n } g ( 2 ^ n x ) | = 2 ^ { - m } | g ( 2 ^ m x ) - 2 ^ { m - n } g ( 2 ^ n x ) | \le 2 ^ { - m } ( 1 - 2 ^ { m - n } ) \epsilon = ( 2 ^ { - m } - 2 ^ { - n } ) \epsilon $$
which shows that $ \big( 2 ^ { - n } g ( 2 ^ n x ) \big) _ { n = 0 } ^ \infty $ is a Cauchy sequence and hence convergent. It follows from \eqref{0} that $ | g ( 2 ^ n x + 2 ^ n y ) - g ( 2 ^ n x ) - g ( 2 ^ n y ) | \le \epsilon $. Dividing by $ 2 ^ n $ and letting $ n \to \infty $ we see that $ A $ is an additive function. If we replace $ x $ by $ 2 ^ n x $ in \eqref{2} and take the limit, we have the inequality \eqref{1}.
Suppose that $ B $ is another additive function satisfying \eqref{1}. We can see that
$$ | A ( x ) - B ( x ) | = \frac 1 n | A ( n x ) - B ( n x ) | \le \frac 1 n | A ( n x ) - g ( n x ) | + \frac 1 n | g ( n x ) - B ( n x ) | \le \frac { 2 \epsilon } n \text . $$
Hence $ B = A $, and $ A $ is the unique additive function satisfying the inequality \eqref{1}.
At last, we show that if $ g $ is continuous at any point $ x $, then $ A $ is continuous at $ 0 $, and since it's additive, continuous everywhere, which shows that it is linear. Since $ g $ is continuous at $ x $, there is a positive $ \delta $ such that if $ | y | < \delta $ then $ | g ( x + y ) - g ( x ) | < \epsilon $. We then have by \eqref{1}
$$ | A ( y ) | = | A ( x + y ) - A ( x ) | \\
\le | A ( x + y ) - g ( x + y ) | + | g ( x + y ) - g ( x ) | + | g ( x ) - A ( x ) | < 3 \epsilon \text . $$
Since $ A $ is additive, we get that if $ | y | < \frac \delta n $ then $ | A ( y ) | < \frac { 3 \epsilon } n $, which shows that $ A $ is continuous at $ 0 $, and we're done.
Jung, Soon-Mo, Hyers-Ulam-Rassias stability of functional equations in nonlinear analysis, Springer Optimization and Its Applications 48. Berlin: Springer (ISBN 978-1-4419-9636-7/hbk; 978-1-4419-9637-4/ebook). xiii, 362 p. (2011). ZBL1221.39038.
Best Answer
$$f(x)+g(x)=\lambda g(0)f(x)$$ $$\therefore g(x)=\big(\lambda g(0)-1\big)f(x)$$ $$\therefore f(x+y)+\big(\lambda g(0)-1\big)f(x-y)=\big(\lambda g(0)-1\big)f(x)f(y)\tag0\label0$$ $$\therefore f(y+x)+\big(\lambda g(0)-1\big)f(y-x)=\big(\lambda g(0)-1\big)f(y)f(x)$$ Subtracting the last two equations and putting $y=0$: $$\therefore\big(\lambda g(0)-1\big)\big(f(x)-f(-x)\big)=0$$ Now if $\lambda g(0)-1=0$ then $f$ and $g$ are both equal to the constant zero function. Else, $f$ must be an even function. In this case, substituting $-y$ for $y$ in \eqref{0}: $$\therefore f(x-y)+\big(\lambda g(0)-1\big)f(x+y)=\big(\lambda g(0)-1\big)f(x)f(-y)\tag1\label1$$ Adding \eqref{0} and \eqref{1} and using evenness of $f$ we get: $$\lambda g(0)\big(f(x+y)+f(x-y)\big)=2\big(\lambda g(0)-1\big)f(x)f(y)$$ Now if $g(0)=0$ then by the last equation $f(x)^2=0$ and so $f$ is equal to the constant zero function. Otherwise, we get: $$f(x+y)+f(x-y)=\mu f(x)f(y)$$ where $\mu=\frac{2(\lambda g(0)-1)}{\lambda g(0)}$. Now if we define the function $h$ by the equation $h(x)=\frac{\mu}{2}f(x)$ then $h$ satisfies D'Alembert functional equation.