If a block with these markers exists, it is replaced in place. Otherwise
the block is inserted at markers.position (default 'top'), and any
orphaned BEGIN marker of the same type is stripped from user content so it
cannot pair with the new END marker later.
Insert or replace the managed block in file content.