The second derivative of the moment generating function is:
$$
\begin{align}
\frac{d^2}{dt^2} MGF_X(t) &=
\frac{b^2 \, e^{b \, t} - a^2 \, e^{a \, t}} {t \, (b - a)} -
\frac{b \, e^{b \, t} - a \, e^{a \, t}} {t^2 \, (b - a)} -
\left(
\frac{b \, e^{b \, t} - a \, e^{a \, t}} {t^2 \, (b - a)} -
\frac{2 \, \left( e^{b \, t} - e^{a \, t} \right)}{t^3 \, (b - a)}
\right) =
\\
&=
\frac{b^2 \, e^{b \, t} - a^2 \, e^{a \, t}} {t \, (b - a)} -
\frac{2 \, \left( b \, e^{b \, t} - a \, e^{a \, t} \right)} {t^2 \, (b - a)} +
\frac{2 \, \left( e^{b \, t} - e^{a \, t} \right)}{t^3 \, (b - a)}
\\
&=
\frac{
t^2 \, \left( b^2 \, e^{b \, t} - a^2 \, e^{a \, t} \right) -
2 \, t \, \left( b \, e^{b \, t} - a \, e^{a \, t} \right) +
2 \, \left( e^{b \, t} - e^{a \, t} \right)
}
{
t^3 \, (b - a)
}
\\
&=
\frac{
t^2 \, b^2 \, e^{b \, t} - t^2 \, a^2 \, e^{a \, t} -
2 \, t \, b \, e^{b \, t} - 2 \, t \, a \, e^{a \, t} +
2 \, e^{b \, t} - 2 \, e^{a \, t}
}
{
t^3 \, (b - a)
}
\\
&=
\frac{
e^{b \, t} \, \left( t^2 \, b^2 - 2 \, t \, b + 2 \right) -
e^{a \, t} \, \left( t^2 \, a^2 - 2 \, t \, a + 2 \right)
}
{
t^3 \, (b - a)
}
\end{align}
$$
The limit for $t$ tending to zero is (I will apply the Hopital theorem):
$$
\begin{align}
\mathbb{E}[X^2] &= \lim_{t \to 0} MGF''_X(t) = \\
&=
\lim_{t \to 0}
\left(
\frac{\frac{d}{dt} e^{b \, t} \, \left( t^2 \, b^2 - 2 \, t \, b + 2 \right) -
e^{a \, t} \, \left( t^2 \, a^2 - 2 \, t \, a + 2 \right)}
{\frac{d}{dt} t^3 \, (b - a)}
\right) = \\
&=
\lim_{t \to 0}
\left(
\frac{
b \, e^{b \, t} \, \left( t^2 \, b^2 - 2 \, t \, b + 2 \right) +
e^{b \, t} \, \left( 2 \, t \, b^2 - 2 \, b \right) -
a \, e^{a \, t} \, \left( t^2 \, a^2 - 2 \, t \, a + 2 \right) -
e^{a \, t} \, \left( 2 \, t \, a^2 - 2 \, a \right)
}
{
3 \, t^2 \, (b - a)
}
\right) =
\\
&=
\lim_{t \to 0}
\left(
\frac{
e^{b \, t} \, \left( t^2 \, b^3 - 2 \, t \, b^2 + 2 \, b + 2 \, t \, b^2 - 2 \, b \right) -
e^{a \, t} \, \left( t^2 \, a^3 - 2 \, t \, a^2 + 2 \, a + 2 \, t \, a^2 - 2 \, a \right)
}
{
3 \, t^2 \, (b - a)
}
\right) =
\\
&=
\lim_{t \to 0}
\left(
\frac{
e^{b \, t} \, t^2 \, b^3 -
e^{a \, t} \, t^2 \, a^3
}
{
3 \, t^2 \, (b - a)
}
\right) =
\\
&=
\lim_{t \to 0}
\left(
\frac{
e^{b \, t} \, b^3 -
e^{a \, t} \, a^3
}
{
3 \, (b - a)
}
\right) =
\\
&=
\frac{
b^3 - a^3
}
{
3 \, (b - a)
} =
\\
&=
\frac{
(b - a) \, (a^2 + a \, b + b^2)
}
{
3 \, (b - a)
} =
\\
&=
\frac{
a^2 + a \, b + b^2
}
{
3
}
\end{align}
$$
The variance is:
$$
\begin{align}
Var(X) &= \mathbb{E}[X^2] - \left( \mathbb{E}[X] \right)^2 = \\
&= \frac{a^2 + a \, b + b^2}{3} -
\frac{(b - a)^2}{4} = \\
&= \frac{4 \, a^2 + 4 \, a \, b + 4 \, b^2 - 3 \, a^2 - 6 \, a \, b - 3 \, b^2}{12} = \\
&= \frac{a^2 - 2 \, a \, b + b^2}{12} = \\
&= \frac{(b - a)^2}{12}
\end{align}
$$
Best Answer
The equality $\int_a^be^{tx}\frac{1}{b-a}dx=\frac{e^{tb}-e^{ta}}{t(b-a)}$ is valid only if $t \neq 0$. For $t=0$ we get $\int_a^b\frac{1}{b-a}dx=1$