How do i make a Linear Spline??

Hello i have been trying to modify this script i have so it is a Linear spline instead of a (Catmull)Bezier like in Pic1 but my results are in Pic2, would anyone know how to do/fix this?

(My Error is obviously in line 29 to 39 the calculation of the spline, i know this question is rather stupid since it uses simple math)

-Pic1 (what i am trying to achieve)
[77278-capture44.png*|77278]
-Pic2 (the results i am getting)
[77279-capture43.png*|77279]

Here is my code so you know what i have done. i believe my mistake is in the Vector3 ReturnCatmullRom.

using UnityEngine;
using System.Collections.Generic;

public class LinearSpline : MonoBehaviour {

    public List<Transform> controlPointsList = new List<Transform>();

    public int segCount = 2;
    public bool isLooping = true;

    void OnDrawGizmos()
    {
        Gizmos.color = Color.white;

        for (int i = 0; i < controlPointsList.Count; i++)
        {
            Gizmos.DrawWireSphere(controlPointsList*.position, 0.3f);*

}
for (int i = 0; i < controlPointsList.Count; i++)
{
if ((i == 0 || i == controlPointsList.Count - 2 || i == controlPointsList.Count - 1) && !isLooping)
{
continue;
}

DisplayLinearSpline(i);
}
}
Vector3 ReturnLinearRom(float t, Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3)
{
Vector3 a = p0;
Vector3 b = p1;
Vector3 c = p2;
Vector3 d = p3;

Vector3 pos = a + b + c + d;

return pos;
}

void DisplayLinearSpline(int pos)
{
Vector3 p0 = controlPointsList[ClampListPos(pos - 1)].position;
Vector3 p1 = controlPointsList[pos].position;
Vector3 p2 = controlPointsList[ClampListPos(pos + 1)].position;
Vector3 p3 = controlPointsList[ClampListPos(pos + 2)].position;

Vector3 lastPos = Vector3.zero;

for (int t = 0; t < segCount; t++)
{
float n = (float)t / segCount;
Vector3 newPos = ReturnLinearRom(n, p0, p1, p2, p3);

if (n == 0)
{
lastPos = newPos;
continue;
}

Gizmos.color = Color.white;
Gizmos.DrawLine(lastPos, newPos);
lastPos = newPos;

Gizmos.DrawSphere(newPos, 0.3f);
}

Gizmos.DrawLine(lastPos, p2);
}

int ClampListPos(int pos)
{
if (pos < 0)
{
pos = controlPointsList.Count - 1;
}

if (pos > controlPointsList.Count)
{
pos = 1;
}
else if (pos > controlPointsList.Count - 1)
{
pos = 0;
}

return pos;
}
}
*
*

You realize the original code was drawing a spline out to screen in a loop because it needed to draw little line segments to make the curve so it had to loop. You have no need to do that you are drawing a line between the control points so use Gizmos.DrawLine directly

// Draw line between each control point
for (int i = 0; i < controlPointsList.Count-1; i++) {
    Gizmos.DrawLine(controlPointsList*.position, controlPointsList[i+1].position);*
*}*
*// Finally line between first and last control point*
*Gizmos.DrawLine(controlPointsList[controlPointsList.Count-1].position, controlPointsList[0].position);*
*
*

You sort of show the midpoint as well and if you want that then simply add the two control positions together and divide by two.