Indentation in Python is significant: it defines what code is in what block. And to be in a block, code must be at the same indentation level.
So this is valid:
for foo in bar:
doSomething
doSomethingElse
doSomeMore
And so is this:
for foo in bar:
doSomething
doSomethingElse
doSomeMore
But this isn't:
for foo in bar:
doSomething
doSomethingElse
doSomeMore
Because the system has no idea what block of code
doSomethingElse
is part of.
Your indentation isn't consistent, which means you get the error you describe.