The WiFi network connection bears no direct relation to your cellular connection. They are two different radios in your iPhone connecting with two different service points. Your problem is with your iPhone's cellular radio talking with AT&T, and has nothing to do with your WiFi connection.
Did you get a new SIM from AT&T for use with the new iPhone or did you take the SIM out of the previous phone? If you took it out of a previous phone (like an old 2.5G phone), the old SIM may be incompatible with your new 4G LTE iPhone. You will need to visit or otherwise contact AT&T and get them to furnish you with a new 4G LTE SIM and move your mobile telephone number onto that new SIM.
Good luck.