The only good solution is to get rid of the cause of the marks.
That will mean removing all the staples and pulling out all the nails. If you can't pull them out, drive them in deeper using a nail punch. At this stage, it will look worse than when you started, so you move on to the next stage.
Using a decent wood filler, fill all the holes and scrapes and leave it to dry/set. Use a fine sandpaper to smooth the filler.
Now you have a smooth surface to paint but it is not a good idea to go straight to gloss. It would benefit from having an undercoat before the gloss coat. Ideally, you'd use a primer before the undercoat but, realistically, most of it was already painted so I'd go straight to an undercoat - if time and money permit.
What I am suggesting is a big job. It would be an even bigger job in the future if you leave it and gloss over it.
I suppose it depends whether it is your property and how nice you want it to look.