Dysgraphia, per Dorland's Illustrated Medical Dictionary 31st Ed., is simply "difficulty in writing." Therefore, I disagree that this is a correct answer.
Agraphia is defined as:
"Impairment or loss of the ability to write; it takes two forms, one involving poor morphology of written letter forms and the other a reflection of the aphasia also observed in spoken language... Called also graphomotor aphasia"
I do think you need to carefully make a distinction between the person who never learned to write and those who have lost the ability to write. One may be a learning issue, whereas the other can be the result of a neurologic problem, such as a stroke. Agraphia and dysgraphia are terms that imply that the ability was once there, but is now either impaired or lost.
I don't know of a term that would cover the loss of the ability to write through disuse.