Creating a script to remove iPhone accounts and perform a factory reset is not straightforward and generally not recommended due to the potential for misuse and ethical considerations. Additionally, Apple has strong security measures in place to prevent unauthorized access to accounts and devices.
If you are trying to factory reset an iPhone for legitimate purposes, like preparing it for sale, here is a general guideline on how you can do this


