as far as i can remember, you can read the ini file, but if HFS is running you can't just write to it, because changes are lost.
your program should read from the ini (just the first time)
then it processes the accounts line, builds the new one, then it should call
hfs -c accounts=xxxxxxxxxxxxxxxxxxxxxxx