You can travel by train from Kuala Lumpur North to Thailand on the Andaman Sea Coast going through: Ipoh, Butterworth and Padang Besar at the Thai border. From Butterworth you can take a Ferry to Georgetown Penang.
Or on the South China Sea Coast by first going South through Seremban, Tampin, and Gemas; then North to Mentakab, and Tumpat. From Tumpat you can take a bus and a ferry to the Perhential Islands.
To reach Kerteh, you need to take a bus from Mentakab to Kuantan, then the train. There is a proposed railway link from Mentakab to Kuantan.
From KL to Singapore, you travel South through Seremban, Tampin, Gemas, and Johor Baru; then on to Singapore.
To reach the ports on the Andaman Sea coast by train: Port Klang.There is a direct train route from KL. Port Dickson. Train route through Seremban Malacca. Take the train to Tampin, then a bus to Malacca. There is a proposed train route from Tampin to Malacca.
TIP For overnight train rides, a cabin is highly recommended. You will need to reserve it at least a couple of days ahead of time.