If you don't have a diagnosed disability or medical condition that makes it difficult to write then you are expected to have learned to write legibly. All you can really do is practice writing.
If your school thought you might have dyslexia or dyspraxia or something like that and that's why you were given permission to type exams, you might want to contact your uni's disability services to arrange screening to see if it is likely you have a disability before getting a full test done as they are expensive.