Right can be an adjective or an adverb. As an adjective it modifies nominals and as an adverb it modifies verbals. Gerunds are privy to both nominal and verbal classes, which is why writing can be modified in both ways:
Adjective + Gerund
right writing (a correct piece of writing)
Gerund + adverb
writing right (writing correctly)
All the best.
Interested in Language