How to open the attach PNABs in Rich text field and change some info and save back into Rich text field, 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 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 while detaching form profile or when it attached in user document.

Please let me best options or

Thanks