The idea is to "walk" around the loop and tabulate the voltage drops (or rises) that occur due to any currents flowing the components.
So for the first loop, beginning with the battery's rise,
9V - I1*R1 - (I1 - I2)*R2 = 0
Note that R2 has two currents running through it: one from the first loop and one from the second.