Possible meanings are that 1) Doeg had some religious work regarding Yahweh to do there. AT: "for some work before Yahweh" or 2) Yahweh detained Doeg there. AT: "because Yahweh had detained him there" (See: [[rc://en/ta/man/translate/figs-activepassive]])
You may need to say clearly that Doeg saw what David did. AT: "Doeg ... herdsmen, and he saw what Ahimelech did" (See: [[rc://en/ta/man/translate/figs-explicit]])
# Doeg
man's name (See: [[rc://en/ta/man/translate/translate-names]])
# herdsmen
the keepers and protectors of a herd, especially of cattle or sheep