I have downloaded various piano midi files from the internet, but when I tried to play them in e.g. Garage Band, it sounds worse than ones I've created that have sustain pedal applied for each measure. I can certainly open each in MuseScore and add a sustain pedal to each measure manually, but it's very labor intensive and repetitive. I tried once and although that did improve the quality, I don't want to do it again. Is there a way to automate this process?
Assuming that by "measure" you mean 'bar', surely you could manually create one pedal CC command and then copy/paste it to all the other bars.
You could certainly do this in a list editor (raw midi data vs time) and should be able to do it in a piano-roll editor.
If your software has a logical editor then you may be able to tell it to include a pedal press at the start of each bar and lift it again a few milliseconds before the end of the bar.
I'm not sure that Garage Band has these facilities but there are plenty of free midi editors around that will allow you to do this sort of manipulation.