How to make an object walk from one point to another and back in 2D?

i tried this and is not working can somebody tell me how can my object not respect any condition and not trigger any if?

private float wlcopy = 0;
private float wrcopy = 0;

    if (wlcopy <= 0 && transform.rotation == Quaternion.Euler(0, 180, 0))
    {
        StartCoroutine(MoveRight());
    }

    if (wrcopy <= 0 && transform.rotation == Quaternion.Euler(0, 0, 0))
    {
        StartCoroutine(MoveLeft());
    }

Did you debug your rotation and both conditional blocks? Something like

Debug.Log("block left-rot:= "+transform.rotation); ..

First condition should be true due to initialization with 0.
I don’t know if you should compare rotation by using ‘==’,another function to compare rotation would be

Quaternion.Angle(transform.rotation,Quaternion.Euler(0,180,0)) < 0.1  // or some other threshold

See this answer: how do I compare Quaternions? - Questions & Answers - Unity Discussions