Does it specifically need to be a function that does this? Desmos will natively join points together from a list, if that’s all you need:
Does it specifically need to be a function that does this? Desmos will natively join points together from a list, if that’s all you need: