First, there's no such thing as "looping out a ... button". That makes no sense at all.
Reading the rest of your question, it's not entirely clear what you're doing and where. But, if you're only getting an "output" of a single item, it could be because you keep replacing the innerHTML of an item instead of adding the new content to the old:
document.getElementById('output').innerHTML = output;
If you want to add the content, you have to, well, add.
document.getElementById('output').innerHTML += output;