There can be many reasons for hair loss or
baldness like excessive compulsive pulling of hair, trauma, chemotherapy, severe stress, iron deficiency, fungal infections, and hyperthyroidism. Premature male baldness is linked to genetics. It appears to be a X linked trait.
Do you have baldness in your family?
If yes then it can be cause in your case otherwise it seems to be secondary to trauma during shaving.
Take care!