To start with you could use the following code. For security you could also add some nonce check and even use the settings api. Here plugin-test
is your plugin folder name.
$file = stripslashes('plugin-test/style.css');
$plugin_files = get_plugin_files($file);
$file = validate_file_to_edit($file, $plugin_files);
$real_file = WP_PLUGIN_DIR . '/' . $file;
if( isset($_POST['plugin_test_settings']['newcontent']) ) {
$newcontent = stripslashes($_POST['plugin_test_settings']['newcontent']);
if ( is_writeable($real_file) ) {
$f = fopen($real_file, 'w+');
fwrite($f, $newcontent);
fclose($f);
}
}
$content = file_get_contents( $real_file );
$content = esc_textarea( $content ); ?>
<table class="form-table">
<tbody>
<tr valign="top">
<td>
<textarea cols="70" rows="25" name="plugin_test_settings[newcontent]" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
</td>
</tr>
</tbody>
</table>