Question: how to transfer data from old iphone to xr?
Answer: Open Settings on your old iPhone.
Tap the Apple ID banner.
Tap iCloud. Source: iMore.
Tap iCloud Backup.
Tap Back Up Now. ... 
Turn your old iPhone off once the backup is finished.
Remove the SIM card from your old iPhone or if you're going to move it to your new one.