How to make an object to go from point A to point B and then from point B to point C

Hello, I just started to use Unity3D and I have to make an object to move through a room. Can you help me with the script for the object to move from point A to point B and then to point C? Also I tried like a couple of days ago but I’m getting stuck at some weird problem… When the game object reaches point A(Empty Game Object) the camera starts to rotate back and forth.

public GameObject g;
Vector3 points;
int index;
int i;
void Start () {
g = GameObject.CreatePrimitive (PrimitiveType.Cube);
points = new Vector3[3];
points [0] = new Vector3 (5, 5, 5);
points [1] = new Vector3 (-5, -5, -5);
points [2] = new Vector3 (4, -4, 0);
}
void Update () {
g.transform.position = Vector3.MoveTowards (g.transform.position,
points[index], Time.deltaTime*2);
if(g.transform.position==points[index]){index++;if(index>points.Length-1){index=0;}}}

// Drag & Drop the gameobject which should move
public Transform myTransform;

// Drag & Drop all the GameObjects (empty) the transform must go to
public Transform[] positions;

private void Awake()
{
    if( myTransform == null )
        myTransform = GetComponent<Transform>();
    StartCoroutine( Run() );
}
// Duration = The time needed for the transform to go from A to B
// WaitTime = The time the transform will wait between the "trip" from A to B and from B to C.
private IEnumerator Run( float duration = 5f, float waitTime = 3f )
{
    int index = 0;
    float time = 0;
    WaitForSeconds wait = new WaitForSeconds( waitTime );
    while( true )
    {
        Vector3 startPosition = positions[index].position;
        Vector3 endPosition = positions[ (index + 1) % positions.Length].position;
        for ( time = 0 ; time < duration ; time += Time.deltaTime )
        {
            myTransform.position = Vector3.Lerp( startPosition, endPosition, Mathf.SmoothStep( 0, 1, time ) );
            yield return null;
        }
        myTransform.position = endPosition;
        index = ( index + 1 ) % positions.Length;
        yield return wait;
    }
}

or I was recently learning off some youtube channels, and they had some called ‘Pathfinding tutorials’ which is about how to set paths using trigger colliders. It was actually quite simple but sorry i dont know enough to actually post a description