Islam does not oppose composing poems if they are for a good purpose. The Prophet (peace and blessings of Allah be upon him) encouraged the companion HassanIbnThaibt to use his poetry to defend Islam. If these words are good and do not have impolite words and do not call for mischief, then earning is halal and you should not worry about that.
The eminent Muslim scholar and renowned Da`iyah, Sheikh `AbdelKhaliqHasan Ash-Shareef, states: “It is not haram to make living of writing songs as long as the words used are not calling for lewdness or would affect people’s behaviour and feelings. It is reported that the Prophet (peace and blessings of Allah be upon him) did not oppose one of the companions who composed a poem to seek the Prophet’s (peace and blessings of Allah be upon him) pardon and tolerance. Hence, as long as the songs you write are in the frame of virtues and will not make any kind of misbehavior, then there will be no problem.”
Sheikh Ahmad Kutty, a senior lecturer and an Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, issued the following: “I don’t believe that music in itself is considered haram (prohibited); it is just like all other forms of entertainment; the haram of it is haram, and the halal (permissible) of it is halal. How can Islam prohibit all forms of music when it is based on balance, and harmony and has a sound nature?
Islam forbids music that contains themes or messages that are profane, immoral, and degrading to the human spirit. So any music that falls into this category shall be considered haram. On the other hand, any music that uplifts the human spirit, and contains noble and ethically sound themes is considered permissible.”