how to make AI move to target positions

I am making a RTS game, I know how to make the mouse select military units, but i don’t know how to make the AI move to a the mouse position with Vector3.MoveTo(transform.position, Vector3 targetposition)

Camera.ScreenToWorldPoint() with mouse position should be what you are looking for.