A flock is a group of sheep. The shepherds were caring for their sheep, and protecting them from harm or theft.
The shepherds were very afraid when a supernatural angel appeared.