All apps are purchased from Apple or Google, so when you buy an app, the purchase is associated with the Apple ID or Google account that bought the app. This means you can always get past purchases back for free.
The key piece of information to double-check is that you are signed in with the same account that bought the app originally.
Both Apple and Google have good articles on how to get your apps back by reinstalling:
Apple: https://support.apple.com/kb/HT211841
Google: https://support.google.com/googleplay/answer/113410?co=GENIE.Platform%3DAndroid&hl=en