Alliteration helps bring the poem's extended metaphor—which imagines a steam train as a surreal horse-like creature—to life on the page. In the first stanza, the speaker marvels at how the train seems to gobble and drink up the landscape:
I like to see it lap the Miles —
And lick the Valleys up —
Here, alliteration imposes itself on the poetic line as powerfully as the train imposes itself on its environment. The /l/ sound also makes the reader perform a lapping/licking motion with the tongue. (Try saying these lines out loud to hear this effect.)
The train-horse is as noisy as it is fast. As it travels, it makes a noise described in line 12 as a "horrid — hooting stanza." This refers to the train's whistle, which echoes across the landscape. Again, the alliteration is intentionally brash and emphatic, capturing the train's startling sound. The /h/ sound is breathy, too, making the reader exhale air, just like the train blowing off steam. (Other repeated consonants in the poem—such as the /p/ in words like "prodigious," "Pile," and "peer" and the hard /c/ sound in "crawl" and "Complaining"—are hard plosives that also help capture the racket the train is making.)
In lines 15-16, alliteration signals the end of the train's journey:
Then — prompter than a Star
Stop — docile and omnipotent
At its own stable door —
Even coming to a stop, the train makes a lot of noise. The repeated /st/ sound evokes the halting of the train as it brakes. Also, /t/ is a "stop" consonant: when you pronounce it, your tongue blocks your airflow. Another example, then, of the poem's sound matching its imagery!