If that’s your hierarchy (Camera at root), then line 29 and 30 are the same transform, hence only one of those lines will win, the second one… the one that looks up / down.
Hey, look at that… that’s the exact problem you reported!
If I had to guess, the above script is supposed to be on the character, and the Camera is supposed to be a child, which is not the case in your hierarchy above.
PS. If you would prefer something more full-featured here is a super-basic starter prototype FPS based on Character Controller (BasicFPCC):
That one has run, walk, jump, slide, crouch… it’s crazy-nutty!!