It is possible write something so well that it does not need to be edited. This usually occurs only after years of lessons and then, over and above that, the creation of short pieces in an area in which one has significant practice.
In general, however, especially for beginners, editing is important. For most people this begins by being students who have teachers who provide a lot of correction and the introduction of new material.
The next step is often self editing and involvement with groups in which peer criticism in allowed.
A good word of advice about editing: some can be done soon after the first draft – perhaps removing the kinds of errors one has grown best at self-correcting. In general, the more emotional investment that has gone into the creation of the work, the more it will be important to only edit it when one feels more emotional distance from the piece of work. Otherwise, get someone else to edit the thing and then go over it again. Both may well be helpful.
How professional or commercial the piece is also influences patterns of editing behavior.