Theming / modifying the markup of default search block form
First of all nothing is "magical" and if you are new to drupal then you have not looked into the Form API or ignored it.  

What you are trying to do resides on hooking into the form api using the hook_form_alter or hook_form_FORM_ID_alter functions.  The "magical" inline elements on your form are being handled by the form API I spoke of.  You are trying to enter form elements and a button into a template file which is not only a security issue but is not the way that drupal handles forms.

You will need to create a custom module and add your hook_form into there and use the form api I spoke of to handle what you are trying to do.