Vector Lerp make weird things

public class CameraRotation : MonoBehaviour {

public Transform camera;
public Vector3 vector;
public float rotateValue;
public float smoothSpeed = 0.125f;

void LateUpdate()
{
    vector = new Vector3(0f, 0f, rotateValue);
    Vector3 smoothRotation = Vector3.Lerp(transform.eulerAngles, end,smoothSpeed * 
    Time.deltaTime);

    if (Input.GetKey("a"))
    {
        transform.eulerAngles = -smoothRotation;
    }
    else if(Input.GetKey("d"))
    {     
        transform.eulerAngles = smoothRotation;
    }
    else
    {
        transform.eulerAngles = Vector3.zero;
    }
}   

}

I tried to Lerp the camera angle on the z axis. But it works only in positive direction. If the value gets negative it turns to a weird spot.

Vector3.Lerp linearly interpolates the x, y, and z components of the vector, but this doesn’t account for wraparounds from 360 degrees to 0 degrees (otherwise, position interpolation would be messed up).

To interpolate angles, you’ll want to work with Quaternions and Quaternion.Lerp instead. See Quaternion.Euler for how to convert a Vector3 euler angle into a quaternion.