Stop transform position moving objects together

I’m using transform position to make an object bob up and down, this works fine, however if there are two objects using the same script they move towards each other. How do I stop this?

Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Rotator : MonoBehaviour {

    private Vector3 startPos;
    private Vector3 endPos;
    private static Vector3 moveTo;
    public static float moveSpeed = 0.005f;


    private void Start()
    {
        startPos = this.transform.position;
        endPos = this.transform.position - (new Vector3(0, 0.3f, 0));
    }
	
	// Update is called once per frame
	void Update () {
        transform.Rotate(new Vector3(15, 30, 45) * Time.deltaTime);

        if(transform.position == startPos)
        {
            moveTo = endPos;
        }

        if(transform.position == endPos)
        {
            moveTo = startPos;
        }

        transform.position = Vector3.MoveTowards(this.transform.position, moveTo, moveSpeed);
    }
}

I tested your code and found the problem. The moveTo variable is static. It was messing up the movement of the objects. Without the static modifier the code worked fine.