Loop g-code instead of Continuous Linear interpolation?

The Attached Slicer Script takes a curve and deconstructs it into coordinates, when a three-dimensional object is converted into points using this method there are many repetitive coordinates, typically only the Z changes, how can we create a LOOP command that arrays the curve without duplicating all the coordinates in the code? Thank you

Simple Slicer.gh (12.9 KB)

just using the array function
Simple Slicer.gh (9.2 KB)