The literary device that the poet uses in this poem is:
Personification is a literary term that is used to give the qualities of a living thing to an inanimate object. A train is an inanimate object that is made to assume the qualities of a living thing which is the horse. Sometimes, the inanimate things are given the qualities of normal humans.
Personification is one of the many parts of speech. Others include simile, metaphor, hyperbole, onomatopoeia, allegory, etc. Simile is a way of comparing two things or more. To achieve that, the words, 'as' and 'like' are used.
Also, hyperbole is a way of exaggerating something. For example, if we say, he had a mountain of problems, the word 'mountain' is being used to describe how big the person's issues are. It is good to learn how to use the different parts of speech because they improve the quality of a person's writing.
Learn more about personification here:
https://brainly.com/question/1013597
#SPJ1