With this line
var progressBar = document.getElementById('progressBar');
you are trying to access a <progress> element with id="progressBar", but with this code
pbar.setAttribute('id', 'progressBar' + i);
you created the <progress> elements with id="progressBar0", "progressBar1" etc. respectively. So there is no <progress> element with id="progressBar". The same can be applied to the <div> with id="report"