If you created recovery disks and they were corrupted, then you may need to order new media to do a clean install if you want Windows 8. If the reformat and install process started and it reached the point where it was installing drivers, then you may have a recovery partition back on your system.
If this is the case, you should try booting from the recovery partition by pressing F11 on your keyboard when the computer is turned one and the recovery may start from the disks. If the option exist to do a minimal install, I would choose this to get a clean install of Windows back on your system without the drivers and HP Personalizations. If it turns out that no recovery partition was re-installed, then I would attempt the same process from the disc. It is possible that the corrupted disc could install Windows without the restarting that you experienced.
If however, this is not the case, then you can install Windows 8.1 on your system with your existing Windows 8 product key. Microsoft has documented this in Upgrade Windows with only a product key.
If you upgraded to Windows 10 already, you can view Download Windows 10 Disc Image (ISO File) instead.