Answer
$$t=\pi\sqrt{\frac{R}{g}}\approx31\;min\;44\;sec$$
Work Step by Step
Here we can find that the distance between train and the center of the earth is $d$ as shown in the image.
Now the gravitational force, $F_{total} = G\frac{Mmd}{R^3}\;$[M is the mass of earth and m is the mass of the train]
Now the x-component of the force will accelarate the train.
So, the force: $$F = G\frac{Mmd}{R^3}sin\theta\\
or, F= G\frac{Mmd}{R^3}\frac{l}{d}\\
or, F = G\frac{Mm}{R^3}l = \frac{gml}{R}$$
Here g is the gravitational constant. So it will cause an simple harmonic motion.
So the total time of travel, $$t = \frac{T}{2}=\frac{1}{2f}= \frac{\pi}{\omega} = \pi \sqrt{\frac{mR}{gm}} = \pi\sqrt{\frac{R}{g}}\approx31\;min\;44\;sec$$