So here's a way to solve your problem,
First to be clear as you wanted to add certain markup directly inside your code, I put those inside a variable. Kept the child node in another variable, appended that with existing markup and updated certain elements as asked for.And I would surely ask for a better solution if available.
Here's the script for your scenario,
$(document).ready(function(){
//checks if no. of image is > 1
if($(".summary").children().length > 1){
// gets all elements inside that div
var images = $(".summary").children();
//makes that div empty
$(".summary").empty();
//kept whole markup inside a variable
var newLayout = "<div class='te-container'> <div class='te-controls'><select id='type'><option value='te-flip1'>Flip 1</option><option value='te-flip2'>Flip 2</option><option value='te-flip3'>Flip 3</option><option value='te-flip4'>Flip 4</option></select><a id='te-next' href='#' class='te-next'>next</a><div class='te-shadow'></div></div><div id='te-wrapper' class='te-wrapper'><div class='te-images'></div><div class='te-cover'></div><div class='te-transition'><div class='te-card'><div class='te-front'></div><div class='te-back'></div></div></div></div></div>";
//appends the layout inside .summary div
$(".summary").append(newLayout);
//adds the images inside new div
$(images).clone().appendTo(".te-images");
//gets first child image of .te-images
var firstImagePath = $(".te-images img:first-child").attr("src");
//adds first child image of .te-images inside .te-cover div
$(".te-cover").append("<img src="+ firstImagePath + " />");
}
});