and get error saying Private Key for Address ****** is not known (code -4)
You probably created a descriptor wallet. I understand there are good reasons for Bitcoin Core to switch, but I find it annoying to deal with. Getting a private key is a lot of work.
I'm not even sure if the latest version still allows non-descriptor wallets, so
I just used version 26.1. That link shows how I did it from the command line. In short:
~/bitcoin-26.1/bin/bitcoind -noconnect -deprecatedrpc=create_bdb -datadir=/dev/shm/bitcoin
sleep 5 #wait a few seconds
~/bitcoin-26.1/bin/bitcoin-cli -named -datadir=/dev/shm/bitcoin createwallet qr descriptors=false
~/bitcoin-26.1/bin/bitcoin-cli -datadir=/dev/shm/bitcoin getnewaddress