Update coder.py

Move the writing of extra_source codes(i.e. initializer, looper) after the variable declarations so the variables could be used.