TWRP loop after factory reset from stock android on moto m
it loops because it does not supports TWRP as the default android recovery of mobile. so try to flash the stock recovery image of your mobile after if you want to restore anything. and don't do any factory reset after flashing.