updated code for looping results
out put result of after looping results