Add the <script> block in the <head> section of your page. Then instead of your text box and submit button, write the line:
<gcse:search></gcse:search>
This element will be automatically replaced with a text box and search button at run time. Here is the complete HTML that shows how to use google search:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script>
(function () {
var cx = '012117305473792254352:kosbw5yycts';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<gcse:search></gcse:search>
</div>
</form>
</body>
</html>