I would like to know whether there is any difference in meaning if at all between "to write IN pen" and "to write WITH a pen"
Although to write with a pen and in pen mean more or less the same thing, I do draw a distinction.
Speaking generally, to write with something (where with indicates agency and not accompaniment) usually relates something about the writer, the writer's tools, or the writing process; I can write
To write in something (where in denotes a method or style, not location or position) is to describe some characteristic intrinsic to the writing itself:
In is more exclusive; to say I write with metaphors means you employ metaphors in your writing, whereas to say I write in metaphors means your writing is characterized by the use of metaphors (or even universally comprised of metaphors). To say I write with Latin words similarly means you include Latin words in your writing; to say I write in Latin words means you use Latin words to the exclusion of any others.
I would say that in is more common in expressions, e.g. something written
It is not unheard of in English to use the phrase "write in pen" to mean "write in ink with a pen." One example comes from John Updike, "Rhyming Max," from Assorted Prose (1965),
An earlier instance that a Google Books search finds is from American Law Reports Annotated (1942) [combined snippet]:
And earlier still is this example from Factory Management and Maintenance, volume 96 (1938) [snippet]:
But the expression "write in pen" seems to be a shortened form of "write in pen and ink" (all of the earliest occurrences—and there are more than a few of them, going back to 1894—of "write in pen" and "wrote in pen" in Google Books searches appear as part of the longer phrase "write [or wrote] in pen and ink"), and "pen and ink" makes a nice parallel with "pencil" (which combines the wooden case corresponding to the pen and the graphite medium corresponding to the ink).
Still, as StoneyB observes "write in ink" is the common way to express this idea. It is also older than any formulation of "write in pen," going back at least to 1826 in Google Books search results.
You might expect from the language's preference for the pairing of "write with a pen" and "write in ink" that "write with a pencil" and either "write in graphite" or "write in lead" would be favored as well. But instead, English speakers prefer "write with a pencil" and "write in pencil." The only Google Books matches for "wrote in lead" are as part of the longer phrase "wrote in lead pencil," and there are no Google Books matches for "wrote in graphite" at all.