Please explain why would a dentist use a string when giving you a filling?

Floss? Your dentist may have used floss after the filling was placed to check the integrity of the contact with the adjacent tooth.
String? I'm not sure if you are referring to dental floss to check the contact point and margins of a filling after it was placed, or.....A retraction cord to hold the gums away and keep the area dry in order to place a filling near the gum-line.