Let $f$ have a continuous second derivative. Prove that
$$f(x) = f(a) + (x - a)f'(a) + \int_a^x(x - t)f''(t) dt.$$
This is a modification of exercise 6.6.4 from Advanced Calculus by Fitzpatrick. I have seen that this question has been asked here: Proving $f(x) = f(0) + f'(0)x + \int_0^x (x-t) f''(t) dt$ for all x. However, there didn't seem to be a suitable answer.
Here is my attempt at the problem.
Since $f$ has a continuous second derivative, then the first derivative is also continuous. Therefore, by the first fundamental theorem of calculus, we have that
$$f(x) = f(a) + \int_a^x f'(t)dt.$$
Expanding out the right-hand side of the above using integration by parts, we see that
$$f(x) = f(a) + f'(t)t - \int_a^x tf''(t) dt.$$
This is where I am confused.