I don't agree with your analysis of your English sentence. In the phrase "mostly used in literary contexts", the word "used" is not a past tense. It is present tense, passive voice.
Accordingly, the Spanish would be "se usa" and not what you have.
To talk about such general actions, it is common to use pasiva refleja with the se pronoun, instead of "tú":
Cuando se habla con una persona mayor, se usa usted en vez de tú.
If you want to use tú (or usted), you need to use the imperative form:
Cuando hables con una persona mayor, usa usted en vez de tú.
If you want to use the verb dirigirse, ...
Usually (I'm not certain if always though) what is expressed by means of a gerund form inside a prepositional phrase in English, corresponds to the infinitive in Spanish (in prepositional phrase)...
"for the purposes of bettering" → "con el propósito de mejorar"
"for improving my Spanish" → "para mejorar mi español"