What is the purpose of resistance R1 and R2 in this circuit?
Those are so you can measure the current through the two paths.
One path is the recirculating current through D1, R2, L1, R3 (and C2).
The other path is DC, M1, R1, R2, L1, R3 (and C2).

The point of putting the ground reference symbol at point A, is so that you are measuring the voltage across R1 or R2 directly, and that gives you the current via Ohms law.
It is only a reference point for those measurements, and in no way affects how the circuit operates.