Not sure why you want the entire address in one field but this is what I came up with. The first script in the template loops through the detail table and joins their values into a field separated by a comma. The detail table is their just for reference. Hope it helps.
Add an Extract step based on JavaScript and use the below script to loop through the line child nodes and concatenate them. I have used the <br> separator in this case:
var i = 1, addressBlock ="";
//Pick one of the below loop types:
/* with do while loop
do{
addressBlock += data.extract('./address[1]/line[' + i + ']') + '<br>';
i++;
}while(data.extract('./address[1]/line[' + i + ']'));
*/
/* with for loop
for(;data.extract('./address[1]/line[' + i + ']');){
addressBlock += data.extract('./address[1]/line[' + i + ']') + '<br>';
i++;
}
*/
// with while loop
while(data.extract('./address[1]/line[' + i + ']')){
addressBlock += data.extract('./address[1]/line[' + i + ']') + '<br>';
i++;
}
addressBlock.replace(/^\s*<br\s*\/?>|<br\s*\/?>\s*$/g,'');