In the book Quiet: The Power of Introverts in a World That Can't Stop Talking, the author, Susan Cain, writes:
Flow is an optimal state in which you feel totally engaged in an activity—whether long-distance swimming or songwriting, sumo wrestling or sex. In a state of flow, you're neither bored nor anxious, and you don't question your own adequacy. Hours pass without your noticing. The key to flow is to pursue an activity for its own sake, not for the rewards it brings...
According to influential psychologist Mihaly Csikszentmihalyi, in flow, "a person could work around the clock for days on end, for no better reason than to keep on working."
There is also hypergraphia, which is the overwhelming urge to write.
And also graphorrhea: writing in excessive amounts, sometimes incoherently.