Amend record in csv file using ApplescriptObjC

I have an script which works in Applescript but when I use the same code in an ASOC script it does not. Any amended record is added to the middle of another existing record and does not replace the intended record. I have tried every combination of text items/paragraphs etc but nothing works so a solution wold be very gratefully received.

set theNumber to memberNumber’s stringValue() as text – Coerce Cocoa text to Applescript text
set theFamily to memberFamily’s stringValue() as text
set theTitle to memberTitle’s stringValue() as text
set theInitials to memberInitials’s stringValue() as text
set theSurname to memberSurname’s stringValue() as text
set theAddress1 to memberAddress1’s stringValue() as text
set theAddress2 to memberAddress2’s stringValue() as text
set theAddress3 to memberAddress3’s stringValue() as text
set theAddress4 to memberAddress4’s stringValue() as text

    set amendedRecord to  theNumber & "," & ¬
            theFamily & "," & ¬
            theTitle & "," & ¬
            theInitials & "," & ¬
            theSurname & "," & ¬
            theAddress1 & "," & ¬
            theAddress2 & "," & ¬
            theAddress3 & "," & ¬
            theAddress4
        --
        set fileReference to read "/Users/Ours/Documents/Cats Protection/Membership/CP Members copy.csv" as «class utf8»
        set text item delimiters to return
        set recordList to text items of fileReference
        set item theSel of recordList to amendedRecord
        set fileReference to open for access "/Users/Ours/Documents/Cats Protection/Membership/CP Members copy.csv" with write permission
        set eof fileReference to 0
        write (recordList as text) to fileReference as «class utf8»
        close access fileReference

Wrap the read/open/write/close commands in “tell current application” blocks.

Used “System Events” as the current application and it now works perfectly so thanks for saving my sanity!!
So why does it work in Applescript but not in ASOC?

AppleScript can’t actually read or write; the commands have to be passed to the host application (Script Editor, the applet, whatever). But in an ASObjC app built in Xcode, the concept of a host application works differently.