The first problem is that your memory allocation is wrong (this may be the solution to your problem or may be not, but it's definetly something you must fix).
Malloc is taking as parameter number of bytes of memory to allocate and returns a pointer to the allocated memory, or null if it has failed.
As you do now, struct listA *a = malloc(sizeof(*a));
, you allocate space for an object (you have declared a as a pointer to an object and you alloc size of a's object bytes). You need to allocate memory for an array of objects, which has n*sizeof(*a) bytes, keeping the way you wrote it. You should check if malloc returns null.
Also, be careful that you may exceed the stPhone/stName/marks size.
It's a bad practice to use fflush, unless you really need it and especially on input streams: http://www.gidnetwork.com/b-57.html
fgets(b[i].marks, 12, stdin);
Are you shure that a line with marks has at most 12 characters? I would recommend using another way of reading input, like described here: How to read from input until newline is found using scanf()?