Difficult to advise as I do not know how you’re moving the train atm. There are many ways of doing that.
The most basic one would be to interpolate train speed from 0 to MaxSpeed (and vice versa) during Tick.
Button connected to a FlipFlop node would control the interpolation direction.
Again, the implementation would depend on the way you move the train. Are you using splines for the train track/path?