This is a matter of style, on which people disagree. In the past, people in English-speaking countries, just like the OP, have been taught that such ‘elegant variation’ is desirable, that it makes writing more interesting and appealing, and shows the writer to be sophisticated and educated. Some people nowadays still receive such advice as a part of their education. Much of the present-day stylistic advice, however, goes against the practice, or at least against striving too hard to create variation where it does not occur spontaneously. The opponents of the practice sometimes mockingly refer to it as ‘inelegant variation’.
Consider the following simple example:
I contribute to this site only when I have some free time. These days I
don’t have much free time, so I don’t contribute much.
The style here is unremarkable, but the logical structure of what is being said is perfectly clear. Now suppose that one rewrites that as:
I contribute to this site only when I have some free time. These days I
don’t have much leisure, so I don’t contribute much.
Is this an improvement? The proponents of (in)elegant variation will say that it is, because switching from 'free time' in the first sentence to 'leisure' in the second livens up the text; they would regard the repetition of free time in the original version as off-puttingly monotonous. The opponents will, on the other hand, object that the switch between the two terms obscures the logical structure of what has been said: to appreciate that structure, we now need the additional step of realising that free time and leisure function as synonyms here. While that step is fairly unproblematic and easy in this case, it does add slightly to the mental work one has to do to fully process the text; if (in)elegant variation is practised throughout a long text on a complex subject, the extra burden can make the text substantially more difficult to understand.
Competent, thoughtful people differ on which of these two kinds of consideration they find more weighty. One may also regard them as having different weights in different contexts, and so avoid (in)elegant variation when clarity is of utmost importance, but allow oneself to indulge in it when the nature of the communication allows room for playfulness.
One piece of advice that most people would probably agree on, though, is that one should not attempt (in)elegant variation unless one is thoroughly familiar with the meanings of the terms that one intends to use as synonyms, so as to be fully confident that they can function as synonyms in the given context. In other words, one should not attempt to create such variation by using as a synonym something that one has found by consulting a thesaurus but is not otherwise acquainted with.