For-loop in workers

i want to run a for-loop on cf workers and then render it, but it doesn’t work. does anyone know how?

class SetTransformer {
    constructor(name) {
        this.name = name
    }
    async element(element) {
        element.setInnerContent(this.name)
    }
}
async function handleRequest(req){
const url = await 'https://www.domain.com/test';
const res = await fetch(url);
const link =  await `https://domain.com/api`;
await fetch(link, {method: 'GET'})
.then(function(req) {return req.json()})
.then(function(response) {
blockbody = '';
for (var req = 0; req < response.data.length; req++) {
origin = response.data[req].origin;
blockbody+="<li><a rel='follow' target='_blank' href=''>"+origin+"</a></li>";
}blockbody+='';
}).catch(err => console.error(err));
return new HTMLRewriter()
.on('div#id', new SetTransformer(blockbody))
.transform(res)
}