Unless I'm mistaken, 言葉{ことば}
has a much broader meaning than just "words". In daily usage I hear it used to cover concepts like "speech", "phrase", and "remark".
So I would translate the sentence as essentially:
Write phrases related to railroads.
Or, to turn it into more natural English:
Write something to do with railroads.
So my assumption about the question is that they just want you to write stuff so they can check your ability to express yourself in Japanese. The topic "railroads" is just an arbitrary choice, so you have a page less blank to start from.
Hope that helps.
Edit: Seeing the answer selected above, I think one would have to factor in the context of the level of the test. If they are just testing to see if you know words, and a list as an answer is sufficient, then I guess "words" is a fair translation. "Write words related to railroads". I just assumed the context to be more general, so maybe my translation is less applicable.