if you erased the hard drive and reinstalled Mac OS , in a scenario , in system preferences > iCloud > the iCloud Drive box was turned on , click on option button the desktops and documents box was checked , then the files were saved in the iCloud server .
Again after installation , you have to sign in with same Apple ID and password in system preferences > iCloud , the box for iCloud drive is checked ( click on option button the desktops and documents box is to be checked ) , the files will start syncing from iCloud server .
The easy way is open www.icloud.com with your Apple ID and password , simultaneously open finder than drag and drop those files from www.icloud.com directly in iCloud Drive of finder .
See this screen shot and read these articles https://support.apple.com/en-gb/HT206985
https://support.apple.com/en-in/guide/mac-help/work-with-files-and-folders-in-icloud-drive-mchl1a02d711/10.14/mac/10.14
https://support.apple.com/en-in/HT204025
https://support.apple.com/en-in/guide/mac-help/get-file-folder-and-disk-information-on-mac-mchlp1774/10.14/mac/10.14