There are a few well-known data structures designed for editor uses, such as gap buffers, ropes or piece tables. But the on-disk format of a text file is always linear without gaps, so your options are quite limited. In CP/M, inserting text and saving will always require rewriting the remainder...