But I don't find the programs like iMovie, Garageband, Pages, and Keynote, that appeared when I first turned on the Mac. How can I get them back?
They belong to the owner of the Apple ID, so will be available to re-download once that ID is signed in. If you are wiping this to sell, then the new owner will be responsible for setting it up.
You shouldn't try to do it for them, or all the apps will again belong to your ID, not theirs.
See Apple KB - What to do before you sell, give away or trade in your Mac
Apple pre-loads some apps on top of macOS from the factory that are not part of the downloadable version of macOS .
Just let the buyer know they can download them for free after they wipe the Mac. You wipe once to protect you and they should wipe it once to protect them.