Alternating start and end points for polyline in linear array - how to?

Hi all,
Could anyone assist me with my grasshopper file. I’m attempting to generate a polyline in an array along the Z-Axis where the start and end points alternate to give me a connector between offsets along Z only, i.e connecting the end of one to the start of the next - it’s got me a bit stumped. I’ve attached my results thus far, illustrating the undesired connector in orange.

Cheers

liear array continuous.gh (17.4 KB)

liear_array_continuous_re|690x413

liear array continuous_re.gh (12.6 KB)

something like this?.

Check this as well.


liear array continuous_re.gh (13.6 KB)

Thanks @HS_Kim - clearly not as simple as I thought it to be. Much appreciated.