Take a look here:
ArrayList of objects / Examples / Processing.org
Instead of balls create an empty ArrayList of PVectors in setup().
You don’t have the co-ordinates in the PVector.
I always start simple and build on that.
Consider just storing the PVectors for now and drawing lines in a for loop.
void svgRecord()
{
PGraphics svg = createGraphics(width, height, SVG, "output.svg");
svg.beginDraw();
svg.stroke(255, 0, 0);
svg.line(0, 0, width, height); // This works!
for (int j = 1; j < line.size(); j++)
{
// Your line
}
svg.endDraw();
}
Later you can deal with shapes or create a PShape.
Your approach with shape may very well work… it did not initially when testing.
I throttled back to simply first to get a working example to build on first
Example here of drawing lines from last point to current point:
Vertex Trail with fading alpha possible?
:)