I personally think that modifying ref. data file with test results is a bad idea. Ref. data should be used as ref. data and should stay unmodified during test run. Ref data should not be modified with test results. Just my opinion

Generally speaking, yes, it's possible to get rows from data connector using code. I personally would suggest not mess with code, and especially data connectors, unless absolutely necessary. Doing data connector manipulations via code could easily make your test suite unreadable and very hard to maintain. So you should stick with standard data connector workflow as much as possible.