If you had a Time Machine backup of your Mac before you took it to the Apple Store, you can use /Applications/Time Machine to restore Pages and Numbers. If the Mac has the same internal drive as Word/Excel were installed originally, then you can also reinstall them from the Time Machine backup. You won't be able to install and license Word/Excel by any other means as Microsoft has disabled the license servers for retired Office suites, and for a remaining brief time, requires macOS Catalina (or newer) for new licensed MS Office installations of Microsoft 365, Office 2019 for Mac, or Office 2021 for Mac.
If you do not have a Time Machine backup, then you can get the last compatible versions of Pages and Numbers by launching the Mac App Store and signing in with the same Apple ID as you used to previously install these applications. Press the option key and click on the Purchases tab. You should see an update/install button adjacent to Pages and Numbers. Click that button.
You may be greeted by two dialogs: the first mentioning that you need a newer version of macOS to install either application. Acknowledge that dialog (do not click Cancel), and a second dialog may appear offering to install the last compatible version of Pages (or Numbers) for macOS High Sierra. That would be Pages v8.1, and Numbers v6.1.