During a recent writing session my attention was mostly focused on the writing itself. I wasn't monitoring how I felt, listening to either negative or positive voices in my head "You are stupid" "You are brilliant." The writing felt good, but I wasn't concentrating on my ego either positively or negatively. I was happy but in an unself-conscious way.
Positive focus on the ego or negative focus are both distractions. I can stop and admire myself for a sentence I just wrote without too much interruption, but that isn't the main point. Negative thoughts are worse, when they are about the self and not about the writing, because they interrupt more obnoxiously.
Notice the profound difference between "This sentence still doesn't say what I want it to say" and "I am inadequate; I will never finish this article." Both are "negative" thoughts, right? But the first is specific and productive (you can fix the sentence) and also detached from the ego. You wouldn't break into tears when you realized that a sentence didn't say exactly what you wanted it to. The latter is generalized (cannot be addressed in any way) and wholly unproductive.
So the SMT I derive from this is that your writing is not you. Its imperfections are not imperfections of your self, and its virtues are not virtues of you either. It is an exterior object on which you are working. The more you focus on it and not yourself, the better. If the ego distracts, either positively or negatively, put it back in its place. Feel pride in what you do, or as much anxiety as you want, but separate that from the real work of writing.