Repaint metal railing
Since the surface is already painted I would not use a primer but getting that loose paint off will be important or the same will happen to this coat of paint.
You could use a paint scraper or corse sandpaper to help clean the loose stuff up but I would use an angle grinder with a wire brush , I use cup brushes with twisted wire to clean even badly rusted metal.
Once the loose paint is gone and the surface wiped clean any metal paint would work I like spraying but it can be brushed on   Don’t over work the paint or the brush marks will show.