Using the taylor expansion of $\displaystyle f(x+0) = \sum_{k\ge0}x^k\cfrac {f^{(k)}(0)}{k!} = f(0) + xf'(0)+x^2\cfrac{f''(0)}{2!}+ \cdots$ Since $f''(x) = 0$ then every subsequent derivative is $0$. Thus we have $f(x) = f(0) + xf'(0)$ with $a=f'(0)$ and $b=f(0)$.
EDIT: But the Taylor series of a function does not always converge to the function, in this case the Taylor Series is a polynomial. Check this proof to see how such functions equal to their Taylor series.
You see, no integration at all. This is one of the most important uses of Taylor Series, solving differential equations. Check here for futher details.
Lemme restart your work: $A = [c,d]$
Given a function $f(x) \in C^2[c,d] \space|\space f''(x) =0,\space \forall x\in[c,d]$. Using the Mean Value Theorem, since the second derivative is $0$ then $f'(x) = a \in [c,d]$.
Using the theorem again on $f'(x)$, we have that $\forall x\in [c,d], \space \exists b_1\in[c,x]\space |\space f'(b_1)=\cfrac {f(x) - f(c)}{x -c} =a$ and $\exists b_2\in[x,d]\space |\space f'(b_2)=\cfrac {f(d) - f(x)}{d -x} = a$. Since the function is two times derivable then both the right and left derivative should be equal. Thus we have $f(d) - f(x) = a(d-x)$ and $f(x) - f(c) = a(x-c)$ which implies $$\begin{matrix}
f(x) = ax +f(d) - ad \\
f(x) = ax + f(c) - ac
\end{matrix}$$
Now we have a problem where we have to prove that $f(d) -ad = f(c) -ac$. Assuming it is true then $f(d) -ad = f(c) -ac \space\Rightarrow\space a=\cfrac{f(d)-f(c) }{d-c}$. Since $a= f'(x) = \cfrac{f(d)-f(c) }{d-c}, \space \forall x\in [c,d]$, then our proof is complete and we can conclude that $f(d) -ad = f(c) -ac=b \in [c,d]$ and that $$f(x) = ax +b$$