MERGE and the Cassette Buffer File
Many or most versions of BASIC on these machines would have had a "Cassette Buffer File", and many would also have had a command like MERGE .
Maybe by writing a program line ( or short program ) to that buffer using one of the save to cassette commands ( or POKE, although yes, I excluded that in the question ), and then using the MERGE command to put( or replace ) that line number with what is in the buffer.
I don't know if you would need to include a program file name in that "Cassette Buffer File" .
( Interestingly there was a disassembler for the c-64 that ran from the "Cassette Buffer File" )
AUTO
GW-BASIC and others had a command like AUTO which generates new line numbers ( so you don't have to type them ), but I don't know if it could be used from a program.
. .If AUTO would function from a program then maybe lines could be replaced or added.