So, your character has to write a poem! Either they're in school, lost a dare, or maybe they just enjoy writing poems. The circumstances don't matter, but if you want to come up with a reason, go ahead and share your idea.
The goal here isn't to write a good poem; the goal is to make it sound like your character wrote it.
If you need help with ideas or topics, here's a list of suggestions:
Someone they have strong feelings about (positive or negative)