Wrong/Wrongly sometimes cause a little confusion for English speakers or can generate a bit of controversy, but here's what I've gathered: Wrong is both an adjective and adverb, while wrongly is adverb. It is more natural to use wrong after the verb, while it is more natural to use wrongly before what it modifies, i.e. "Maybe, I heard you wrong," or "He was wrongly accused."
So, I would say that "I wrote it wrong" is more natural than "I wrote it wrongly," but because wrong is also an adjective, the former sentence can sound informal, as though the adjective is being used in place of the adverb (though that's not the case).
If you'd like to avoid the whole issue, you could say, "I wrote it incorrectly."