A DFU loop only happens when you've put your device into DFU Mode (by hardware). Sometimes during the restore with your messed-up IPSW, iTunes will return error 31. This indicates that your device is in DFU Mode and cannot be exited, even after attempting to reboot. This is what's referred to as a DFU loop. The only solution is to restore a working firmware.