Here are some possible reasons why factory reset or other methods aren’t working to delete everything on your iPhone:
You don’t have the passcode. The reset process may require inputting the previous owner's passcode. Without this passcode, you won't be able to reset the iPhone.
You don’t have the iCloud password. When Find My iPhone is enabled on your device, not having the iCloud password can stop the reset process.
There are connection issues or network problems. For example, a faulty USB cable, hardware problems, and connection failures can all cause problems when trying to delete everything on your iPhone.
Bugs in iOS. Try updating your system to the latest version, then try resetting your iPhone again.