Make sure you follow all the instructions for setting up iCloud for your app on this page:
https://developer.apple.com/documentation/gamekit/saving_the_player_s_game_data_to_an_icloud_account
And follow all the instructions for setting up ubiquity containers on this page:
https://developer.apple.com/documentation/xcode/configuring-icloud-services