If I sign up for the 3 free months of Apple Music, do I keep Match-ed songs when the trial ends?
You would need to be sure you have downloaded a copy of all music before the period ends. You don't lose anything stored locally unless you delete the local files, and even if you delete the local files - as long as you re-download them before the end - you will have playable music locally.

This is covered in https://support.apple.com/en-us/HT204962