How to detach PNABs and notes.ini from Rich text field to folder make changes in PNABs and notes.ini and attach in Rich text using Script

HiI have profile document with few rich text fields. one of the rich text field have attach generic PNABs without user name, mail file and mail server and one other rich text field have notes.ini.

I have other form which contain each user information i.e user name, mail file location, mail server and some notes.ini parameter.

I would like to have a agent,for each user it will detach the notes.ini and PNABs from profile to temp directory, from temp open the PNABs and notes.ini, update the information in notes.ini and PNABs and attach it to each user document.

I already have a agent which can attach a notes.ini and PNABs from proflie but not sure how to update the notes.ini and PNABs in temp directory and attach it rich text field.

Thanks