Answer
a) $ v = \sqrt{\frac{2Pt}{M}}$
b) $x = \frac{2}{3}\sqrt{\frac{2Pt}{M}}t^{3/2}$
Work Step by Step
a) We know that work is equal to the power times the change in time. Since all work goes to kinetic energy for the train, it follows:
$\frac{1}{2}Mv^2 = Pt \\ v = \sqrt{\frac{2Pt}{M}}$
(This assumes the train starts at rest. If it did not, a $v_0^2$ term would have to be added under the square root.)
Calling the initial position x=0, we take the integral to find:
$x = \int_0^x \sqrt{\frac{2Pt}{M}}$
$x = \frac{2}{3}\sqrt{\frac{2Pt}{M}}t^{3/2}$