My question is why would he be commiting a mortal sin?
First of all, he is only allowed to withhold absolution if he can reasonably assume, based on what you told him, that you do not have a “firm purpose of amendment” or in some serious way feel bound/compelled to continue in this same sin, and/or if he perceived that you were not truly sorry enough, didn’t recognize/acknowledge your sin to be truly serious, etc.
Rarely are priests supposed to withhold absolution; the vast majority seriously avoid having to do that, and will counsel penitents (encourage them to rethink their sins right then and there during that confession moment, rather than have to “send them away” unabsolved.) It must have been some way he received whatever you communicated to him, that caused him to withhold absolution. Next time, if you’re unsure as why a priest might do that, you should ask them in the confessional, preferably when he announces that.
He is bound to respect the sacrament (not honor sacramental form or matter that is invalid, not engage in dishonest absolution, etc.), or he is violating his duties as a priest, and thus committing a mortal sin. In addition, if he felt that you were not truly repentant, or would not make a concerted effort to cease that sin, or did not examine your conscience properly (prepare for an honest confession), then he could be in a position of cooperating with the pentitent’s sacrilege regarding that sacrament and possibly any subsequent sacriligious communion.
For example, priests have admitted telling a penitent to come back for absolution after they have done a better job examining their conscience, if it seems that the penitent is shining the priest on or has so little to say about their misdeeds, etc.