Getting into any habit takes some time and effort. So, getting into a habit of writing certainly requires time and effort. It can begin with a regular writing class which helps to set the task of at least getting to the class each week. We can find ourselves better motivated when others are involved. Then preparing for the class means thinking about writing and doing tasks set the week before.
It takes diligence to form a writing habit and to get into a routine that enables writing to occur regularly. Actually, it probably takes more than just getting into a routine as well. There's something about a commitment to the craft, a valuing of the time spent writing, and sometimes even justification of the use of the time for writing when it could just as easily be spent doing something else.
There's also something about the mindset that comes with the idea of being a writer. There needs to be an honoring of the urge to write. There needs to be an acceptance of the writing even if it isn't our best or for public viewing. There needs to be an aspect of ourselves which sees us as a writer, that allows us to sit and focus and become engaged in the physical and mental act involved in writing.
It also means building some flexibility into our routines. There may be days when writing just can't or won't happen, for whatever reason. At times like that, we can feel like we've broken the routine and feel like giving up. Or we can remind ourselves that sometimes life just gets in the way of the things most important to us. We can then resurrect our routine and get back on to it again.
Perhaps one of the greatest strengths we can acquire as a writer is self acceptance. Then we can accept ourselves when we break our writing routine to go to the beach, have a sleep or when we get stuck at our day job. Perhaps then we can also truly accept our writing in whatever form it comes, when it comes.