You cannot. The Magnet Train and its Pass are exclusive to Pokémon Diamond, Pearl, and Platinum (Generation IV, Sinnoh). They do not exist in HeartGold/SoulSilver (Johto remakes).
In Diamond/Pearl/Platinum, the Magnet Train connects Goldenrod City (Johto) and Saffron City (Kanto) after obtaining the National Dex and the Pass from a man in Saffron.
No Magnet Train in Johto remakes.