It's impossible to insert more or less bytes in the middle of the file. Of course, you can overwrite some bytes - that's all.
As usually, file editors create new file and write new content to it, then rename or remove the old one and rename new file with the old file name.
so the word program somekind like that?
They load all of them, after you edit, replace the old by the new one?
By the way, MS Word doc file is not a text file: DOC is a (proprietary) binary format.
Yes, it's (one of) possible text editor pattern. Variants:
1. see my post above (safe method)
2. read in memory, edit then overwrite old file from the first changed point (or from the start) to the end - see your post ;)
Did you think that hard disk track is an elastic string which is capable to place additional inserted bytes into the middle of the file contents?