Reset position for all objects in a list

Hi, I have a code that works perfectly but the code is long I have written the same code for each player is there a possible way to make a list of players and don’t need to write the code again, I’m a beginner.

    public GameObject playerPos, playerPos2;
    private Vector3 playerResPos, playerResPos2;
    public GameObject restPos, restPos2;
    
    private void Update()
        {
    playerResPos = restPos.transform.position;
    playerResPos2 = restPos2.transform.position;
    
    private void OnTriggerEnter2D(Collider2D collision)
        {       
                if (collision.gameObject.CompareTag("Player")
                 playerPos.transform.position = playerResPos;
                 playerPos2.transform.position = playerResPos2;
        }

public GameObject PlayerPos;
public GameObject ResetPos;

private void Update()
{
      private void OnTriggerEnter2D(Collider2D collision)
      {
            for (int i = 0 ; i < PlayerPos.Length ; ++i)
            {
                   PlayerPos_.transform.position = ResetPos*.transform.position*_

}
}
}
This should work as long as you have the same number of objects in both the PlayerPos and ResetPos Array