There are two ways to put exisiting code into a loop. First you could create the loop then hightlight all the code you want to put into the loop and drag and drop it inside the loop (the loop border will change when the code is hoving in the loop). The other way is when you are creating the loop you can click and drag to encompass the code you want inside the loop. When you release the mouse button, the loop will be created around the code. In both cases some rewiring may need to be done.