for (let i = 0; i < randomIds.length; i++) {
document.getElementById("idContent").innerText += randomIds[i] + "\n";
}
Use innerText and make sure to use the right newline character combo. Don’t use <br>.
If you really have to, create a container with display:flex; flex-flow:column;
and have each child be it’s own element in that parent.