I think that writing is a way to free the mind of discouraging thoughts and put the imagination to fly in a positive way, and this helps to alleviate depression, at least to me it has been very useful, in my case, I suffer from anxiety, and having the mind busy creating things is a great help.