Hi Georgey18,
Re: Cannot connect to App Store ... when I try to erase the phone the password fails….
You may want to check the new iPhone is updated to the newest iOS software version: Look in Settings > General > Software Updates to see if there's an update.
____________________
If you choose to update: you may want to back-up iPhone first.
______________________________________
If already updated to the newest iOS version:
Try simply restarting the iPhone (deletes temporary fils, re-establishes connections, may update any recent sting changes, and more. Often restores order if something is not working as expected.
_________________
If you still need help:
Apple support have a trouble-shooting article online to help you:
See what to do: If you can't connect to the App Store, iTunes Store, or other Apple services - Apple Support
____________________
For a brand new iPhone: there is help from Apple's experts:
Most Apple software and hardware products include unlimited complimentary support incidents within the first 90 days of product ownership.
One stop for technical support, Apple hardware service, and software support.
Call Apple Support at 1-800-APLCARE
(or use the support link (or support app) on website below)
(ie: Scroll right down to "Support made simple")
AppleCare Products - Apple AppleCare - Apple