While he did not write about trains specifically, his poetry and prose often explored themes of travel, adventure, and the natural world. He was a great observer of human nature and his works often feature journeys, both literal and metaphorical.
Perhaps you are thinking of another poet, or a poem that explores themes of transportation and change, which are common themes in poetry. If you can provide more information about the poem you are looking for, I can help you find it.