... чтоб исключить перебор?
function createPoint(svg, x, y) {
const p = svg.createSVGPoint();
p.x = x;
p.y = y;
return p;
}
const NS = 'http://www.w3.org/2000/svg';
const SVG = document.getElementById('svg_lin');
const point = createPoint.bind(null, SVG);
const new_polyline = document.createElementNS(NS, 'polyline');
const pts = new_polyline.points;
pts.appendItem(point(22, -2));
pts.appendItem(point(32, 19.5));
pts.appendItem(point(22, 39));
SVG.appendChild(new_polyline);