Move with waypoints.

Hi.

I need some help making a script that lets my player move back and forth from a defined spot to another with wasd keys and follow a set of “inbetween” waypoints.

Here is the incomplete script:

public class PathFollower : MonoBehaviour {

public GameObject[] PathNode;
public GameObject Player;
public float MoveSpeed;
float Timer;
static Vector3 CurrentPositionHolder;
int CurrentNode;
private Vector3 startPosition;


// Use this for initialization
void Start () {
CheckNode ();
}

void CheckNode(){
Timer = 0;
startPosition = Player.transform.position;
CurrentPositionHolder = PathNode[CurrentNode].transform.position;
}

void DrawLine()
{
for(int i = 0; i < PathNode.Length; i++)
{
if(i < PathNode.Length - 1)
{
Debug.DrawLine(PathNode[i].transform.position, PathNode[i + 1].transform.position, Color.green);
}
}
}

// Update is called once per frame
void Update () {

DrawLine();
Debug.Log(CurrentNode);

Timer += Time.deltaTime * MoveSpeed;

if (Player.transform.position != CurrentPositionHolder) {

Player.transform.position = Vector3.Lerp (startPosition, CurrentPositionHolder, Timer);
}
else{

if(CurrentNode < PathNode.Length -1)
{
CurrentNode++;
CheckNode ();
}
}
}
}

This script is looping the player between spots and i’m not sure how i can make this work only with wasd keys and have waypoints inbetween a spot to another.
Does someone know how to implement this? Or maybe you have a different solution than the code above?

Lets suppose i have point A and point B, if i’m at point A and press the key W, to reach point B i would need to move through a set of waypoints ahead. And i want to be able to move back to point A through the same waypoints using the key S for example.
How would you do something like that?