Куда и сколько:
const id = 'out';
const count = 10;
Конечно, можно добавлять строки неоднократно:
const $el = $('[id="' + id + '"]');
for (let i = 0; i < count; i++) {
$el.text((_, text) => text + (i ? ', ' : '') + i);
}
// или
(function next(el, i) {
if (i < count) {
const text = (el.innerHTML && ', ') + i;
el.innerText += text;
// или
el.insertAdjacentText('beforeend', text);
// или
el.append(text);
// или
el.insertBefore(new Text(text), null);
// или
el.appendChild(document.createTextNode(text));
next(el, -~i);
}
})(document.getElementById(id), 0);
Но лучше будет сначала собрать текст полностью, и модифицировать содержимое элемента всего один раз:
$('#'.concat(id)).text(Array.from({ length: count }, (_, i) => i).join(', ');
// или
document.querySelector(`#${id}`).textContent = [...Array(count).keys()].join`, `;