Journeys are the midwives of thought. Few places are more conducive to internal conversations than a moving plane, ship, or train. There is an almost peculiar correlation between what is in front of our eyes and the thoughts we are able to have in our heads: large thoughts at times requiring large views, new thoughts new places. Introspective reflections which are liable to stall are helped along by the flow of the landscape. The mind may be reluctant to think properly when thinking is all it is supposed to do. The task can be as paralyzing as having to tell a joke or mimic an accent on demand. Thinking improves when parts of the mind are given other tasks, are charged with listening to music or following a line of trees. (source)
What does <the task> refer to?
Compared with the source, you have made some transcription mistakes:
I think "the task" refers to the activity of writing. If we pay attention to the semantic elements that contribute to the cohesion of the paragraph, we can read that, at the beginning, the author refers to "writing" as "my work," which is lexically closely related to "task." It could also refer to "proper thinking," or "introspective reflections," which is what is required to write a book, as opposed to "other tasks" that involve mental activity but do not require any reasoning, like listening to music and following a line of trees, in the author's words.