The Lord sometimes allows people who are devoted to Him to fall into such dreadful vices; and this is in order to prevent them from falling into a still greater sin-pride. Your temptation will pass and you will spend the remaining days of your life in humility. Only do not forget your sin.
Writing is a fearsome but grand vocation—potentially healing but likewise deadly. I wouldn’t trade my life for the world.