In "where do I write?" "do" is an auxiliar verb - it indicates the present tense. In "I do that", "do" is the main verb - it indicates the action in the sentence. Same word but with different functions.
Latin based languages - so that includes Portuguese - do not have this first "do"; The only "do" we have is the verb "fazer" that always works as a main verb, never as an auxiliar.