Move camera when mouse is near the edges of the screen

void MoveCam()
{
Vector3 camPos = transform.position;
if (Input.mousePosition.x > screenWidth - 30)
{
isCamMoving = true;
camPos.x += speed * Time.deltaTime;
}
else if (Input.mousePosition.x < 30)
{
isCamMoving = true;
camPos.x -= speed*Time.deltaTime;
}

        else if (Input.mousePosition.y > screenHeight - 30)
        {
            isCamMoving = true;
            camPos.z += speed*Time.deltaTime;
        }
        else if (Input.mousePosition.y < 30)
        {
            isCamMoving = true;
            camPos.z -= speed * Time.deltaTime;
        }
        else
        {
            isCamMoving = false;
        }
    }

why isn’t this code working? I’m a noob btw. I have this in the update, I tried commenting out every other part of my camera scripts except this part and it still wasn’t working. What’s wrong with it?

You never assign the new position to your transform :

 transform.position = camPos ;