You may need to have a payment method on file, even if the app you want to download is free.
Check which payment method you have on file
Or -> Sign in to your Apple ID account page and edit your Apple ID details.
https://appleid.apple.com
On the Sidebar click Payment methods -> then tap Payments Methods and tap Manage payment method.
You can also use your Apple ID balance, see ⤵️
Add money to your Apple ID balance
Add money to your Apple ID balance – Apple Support (UK)
What you can buy with your Apple Gift Card or Apple ID balance
What you can buy with your Apple Gift Card or Apple ID balance – Apple Support (UK)