Two angels assigned to each human being write down good and evil deeds. Their responsibility is to preserve a record of conduct, so actions do not simply pass away without accountability.
The expression hafizin refers to their assigned oversight and recording. Belief in this oversight keeps a person aware of accountability for conduct, whether performed openly or away from other people.