it seems that you yet donw't know what the curly brackets are for "{" "}" they embrace blocks of code that shall belong to an if-condition, a for-loop, a while-loop or a function
by pressing Ctrl-T your code gets autoformatted with auto-indention.
And then you will see that your serial prints are inside on of the if-conditions which has the effect of