const urls = [...]
let items = document.querySelectorAll(".grid .item");
items.forEach(function (el, id) {
el.innerHTML = `
<svg viewBox="0 0 155 219" xmlns="http://www.w3.org/2000/svg">
<defs>
<mask id="mask">
<rect width="100%" height="100%" fill="black"></rect>
<circle cx="80" cy="120" r="60" fill="white" stroke="#c00" stroke-width="10" />
<circle cx="50" cy="60" r="40" fill="white" stroke="#c00" stroke-width="10" />
</mask>
</defs>
<image href=" ${urls[id]} " width="100%" height="100%" x="0" y="0"
preserveAspectRatio="none" mask="url(#mask)"/>
</svg>
`;
});
Все остальное вроде как у вас лишнее.