you are reading the camera rotation (line 8), but not writing it back to the camera (line 12 just modifies the value you read)
even if you were reading/writing it, the ‘rotation’ value is a quaternion. I think you’re probably thinking about the eulerAngles property as in the previous answer. However you’d still need to write it back.
As an extra note, simply clamping angles doesn’t always yield the expected result, and I can’t tell what that is from your code. However what I’ve provided above should certainly limit the value that the x component of the camera’s eulerAngles property can take on.