Custom code has removed after repair from from admin panel

i have write a custom code in following file to show a button on detail page. when i Quick Repair and Rebuild, the custom code removed automatically. why this is happining.

custom\modules\Contacts\metadata\detailviewdefs.php

The custom code for button is


array(
'customCode' => '<input name="print_selected_sec" title="Print Card" type="button" class="button" value="Print Card" id="print_selected_sec" />',
)

Button on detail page

You should be doing it with the Extension mechanism under custom/Extension

See an example here

https://community.sugarcrm.com/thread/21257