um building a tower defence game and i created and empty object for the exit point but my enemies dont seem to be walking straight to it they're walking diagonally plz help

this is my script for my enemy to walk to the exit point
enemy.position = Vector2.MoveTowards (enemy.position, exitPoint.position);

Is this code in update function or similar? It could be getting old position of enemy and that is why it is not working.

void Update(){
enemy.position = Vector2.MoveTowards (enemy.position, exitPoint.position);
}