adding script into specific element

adding script into specific element

hi, i want to know how do i merge different script into one that i can upload into file and put it in <head> section
so i want to add this scriot into <div id = 'title-post'>
  1. //< div id = 'title-post' >
  2. var timestamp = "<data:post.dateHeader/>";
  3. if (timestamp != "") {
  4.     var timesplit = timestamp.split(",");
  5.     var date_dayname = timesplit[0];
  6.     var date_daymonyear = timesplit[1]
  7. }

this into < div class = 'n-ofday' >

  1. //< div class = 'n-ofday' >
  2. document.write(date_dayname);

for < div class = 'n-ofmonth' >

  1. //< div class = 'n-ofmonth' >
  2. document.write(date_daymonyear);

for < div class = 's-header' >

  1. //< div class = 's-header' >
  2. document.write(sompret_image_creator("
  3. <data:post.thumbnailUrl/>", "<data:post.title/>"));

  4. //</div></div></div></div> end tag from title-post
i mean, i want to add those script into one file and place it into header.

thanks