It seems like you are having Folliculitis
,which is an inflammation of the hair roots and can be caused by friction,bacterial or fungal infection
As after shaving there must be some friction and when you squeezed the pimple you put more pressure and caused more inflammation.
So I think not to worry and start the treatment with:
ointment apply it twice a day for 5-7 days.
2: tablet Ibuprofen
400mg three times a day after your main meals .in the mean time please don't try to squeeze or pick the lesions because there is a risk of injury
and cross infections.
I hope you ll feel much better,thanks a lot .