"in," is normally short for inside. "In a car," means inside a car, for example.
But in this case "write in pen," does not mean write inside a pen (because that would make no sense at all). In this case "write in pen," means 'write using a pen,' or 'write with a pen.'
So you don't use an indefinite article 'a,' in front of pen because the meaning is not ... do something in a noun, in this case.
We similarly say, in English:
Write in black ink.
Write in block capitals.
Write in your best handwriting.
In none of these cases does the word 'in,' mean inside either.