Why
The beauty of writing something down is that you are then able to check and modify it. Writing in general has been shown to improve the ability to think logically, and when writing in a new language, you can analyse how you would like to get your ideas over.
How
The best way seems to be to first choose a topic, and then just write something down, without worrying about errors. You can then check it over and look for ways to improve things. Writing topic based texts is part of various studies, such as A level. Having a French pen pal can also help with this, as you will be regularly generating some text.
Writing follows progress in reading. If something is wrong then it often simply looks a bit 'out' when you review it. You can then try out different ideas about how to improve things. For instance, at some stage, you may write 'Hier, j'ai visité ma mère'. However, by B2, you will hopefully find this awkward, and prefer the phrase 'Hier, j'ai rendu visite à ma mère'.
Checking
It's impossible to pick up all of your errors by yourself, and there are some programs, and a number of free web sites which will help you with this.
To my mind, this is the best program to use. It tends to get the best reviews and is regularly updated. It can run in Word, and gives you rapid advice about spellings, accents, syntax and grammar, and style. Unfortunately, there is a significant cost, at about £70 (more if you go for the English checking module as well). Also, the most recent version (10) is only for 64-bit systems.
You might be concerned that using such a program would result in over-dependence and lack of progress. However, a 2014 study by Ouellet found that weaker secondary French students using Antidote made better progress than control groups; moreover, this effect increased the more they used the program. The key aspect seemed to be that checking and accepting modifications led students to pay attention to where they were having problems.
Another program is Cordial. This has better integration with Word as it directly underlines text with different colours according to the type of problem. It has an online version , and generally seems to do many of the same things as Antidote. The cost of the program is a bit higher however.
There are also a number of other online sites where you can also check your text for free.
Scribens is probably at least as good, if not better than most.
Though there is also:
You can also try a community where real people will correct your writing, using language exchange social network sites. You also have to correct other people's work in English, as an exchange. It certainly can work, but takes some time to find someone and set things up. Also, it is really boring feeding back on someone's writing - not only do you need to correct what they wrote, but you also need to explain why. This can involve some complex grammar rules which you may not even be aware of, such as adjective order. However, there are a number of sites such as here and here.