Your vote on this answer has already been received
There is a railway station in Shahabad itself. Then there are railway stations in Ambala and Kurukshetra also but no railway station in Pehowa. In order to reach Shahabad railway station from Kurukshetra, you should take a train at 5.50pm at Kurukshetra railway station for shahabad (M.). Then in the morning you can take two trains for Kurukshetra at 7.00am and 8.00am from Shahabad (M.).