Adding loop to an appended var (confused)

Adding loop to an appended var (confused)

Hi ive got a bit of a problem which im finding hard to solve.

ive got a var which has html that im appending to a div.

but i have a loop of information that needs adding inside images div.

how would you normally get the blue data into where the blue ???? are in the var, Im proper confused.

=========================================================================

  var counter = 0;
        $.each(images, function(key, value) {
        counter++;
              if (counter > 4) {} else {
                   <div class="image_loop">
                          <img src="' + value["file_location"] + '" />
                    </div>
                                
              }
}); <div class="image_info">Posted' + counter +' images</div>


var newItems = $('<div id="box">a message</div><div id="images">?????</div>');      

$('#container').prepend(newItems);

=============================================================================

any help will be amazing.

David