No such thing as proper. Indentation is part of the code, you can write different code.
If it was optional then it would be optional.
I edited in a link to where you can run your code. As you can see if you run it, it does not do what you describe.
You might want to call your function, that’s when they run. And then, yes, it’ll do something like that.
I argue that you know what everything there does (look at it. anything alien? no? good to go, then.). If you don’t do the same thing it may be that you’re executing what you think it should do instead of what it says, bypassing the code and running your own different program that you’re envisioning in your mind. So carefully following each instruction will lead to repetition.
Keep in mind that you can also edit it to see what effect things have.
Indeed, printing can also tell you what order things are done, you might insert things like:
all over, that would tell you exactly where it jumps and what the instruction before it was.