Foreach Loop runs only once in Update. I need it to constantly give me Vector3 values

I am new to Unity and programming.
I use foreach loop. It gives me Vector3 that I need to direct AI where it should go. I get values only ones (even though I run it in Update). How can I constantly get my Vector3 values (which will be different with every frame). In this particular case, for example, resultPathListAllyClose is made up of 3 Vector3.

int sizeOfListAllyClose;
Vector3[] moverAllyClose;
int moverAddAllyClose = 0;
void Update()
{
    sizeOfListAllyClose = resultPathListAllyClose.Count;
    moverAllyClose = new Vector3[sizeOfListAllyClose];

    foreach (var a in resultPathListAllyClose)
    {
        moverAllyClose[moverAddAllyClose] = new Vector3(a.x, a.y, -1);
        moverAddAllyClose++;
    }
        Debug.Log(moverAllyClose[0]);
 }

Here my console says
(0.0, 39.0, -1.0)
And then IndexOutOfRangeException: Index was outside the bounds of the array. I want it to show me Vector3 values instead of exception.

move

 int moverAddAllyClose = 0;

inside the Update method

void Update()
 {
     int moverAddAllYClose = 0;
     sizeOfListAllyClose = resultPathListAllyClose.Count;
     moverAllyClose = new Vector3[sizeOfListAllyClose];
     foreach (var a in resultPathListAllyClose)
     {
         moverAllyClose[moverAddAllyClose] = new Vector3(a.x, a.y, -1);
         moverAddAllyClose++;
     }
         Debug.Log(moverAllyClose[0]);
  }