You want to check for errors on each line but do not want to check for errors on each line, shell remembers the last command status, you rather have to pipeline the process.
Two ways :
1) Put your commands in nested if ... then ... fi statements.
2) Chain your commands with && like
command1 && command2 && command3
# Is similar to
if command1
then if command 2
then command3
fi
fi
That will return "0" only if the 3 commands executed successfully. The other thing is that command2 will only be executed if command1 executed successfully, and so on. It's almost preferable to avoid executing a command if the previous operation didn't succeed.