You can buy suitable moss for your hamster in the pet store or order it online. This moss is suitable for animals and has been specially grown for that purpose. I myself use moss from the brands Back Zoo Nature and Trixie.
What is important to know is that moss can always contain living bugs. To ensure that they do not end up in your hamster residence, it is wise to place the moss (in closed packaging) in the freezer for 48 hours and then let it dry in a cool and dark place.
You can use moss several times in the enclosure, so you do not have to throw it away while changing the enclosure. As long as it still looks good and does not smell (due to pee, for example) you can simply reuse it.