How do you write a hymn?
A Hymn is a form of poem or a piece of music that is in praise of something. To write one you basically write a poem with some constraints. Some examples of writers of hymns in literature would be William Cullen Bryant and Percy Bysshe Shelley.
Things to consider when writing would be: syllables per line, rhyming, subject matter, etc.