It is narrated from Sayyiduna Shaddad bin Aws (may Allah be pleased with him); he said: The Messenger of Allah (peace and blessings be upon him) said: "Whoever composes a line of poetry after Isha, Allah does not accept any prayer from him that night."
Hadith Referenceالمعجم الكبير للطبراني / باب الشين / 7102