Writing is often an uncertain process, tied up in thinking, self-reproach, frustration; with concern for where the piece is heading, where it’s been. And this is when it’s going well. When I was writing my first novel, I used the following technique to stay in the moment, to concentrate on each sentence, rather than allowing my mind to range over the entirety of the work.
Put away the laptop, or tablet, and bring a paper notebook or journal to the table. Have two pens at the ready, each with a different coloured ink (I used red and blue). Draft your story using one colour pen for one sentence, then another for the next sentence. Alternate between the two as you write, taking an aware moment to switch pens.
This gives you a necessary pause between sentences, a solely physical action you must attend to. With the new colour, each new sentence will stand out from the last, and keep you in the now of what you are writing. Moreover, you can better see the length of your sentences, and if you are falling into a pattern of similar constructions.
This method works particularly well for a second draft, when you are paying attention to the music of the words in each sentence, rather than rushing to get ideas onto the page.
For more mindfulness exercises, look here.