Prevent adding unnecessary empty lines

When repeatedly calling toc.insert on the same file, new lines were incrementally inserted around the <!-- toc --> and <!-- toc stop --> pseudo-tags.