WordPress File wp-admin/includes/misc.php

insert_with_markers()

Inserts an array of strings into a file (.htaccess), placing it between BEGIN and END markers.