If you want to edit the first byte, you can try this:
ld hl,NAME
rst rMOV9TOOP1
bcall(_ChkFindSym)
ret c ;The program doesn't exist, so exit
ex de,hl
;Just checking to make sure the size isn't zero, otherwise it will edit unknown data
ld a,(hl)
inc hl
or (hl)
ret z
inc hl
ld (hl),30h ;or whatever byte you want
ret
NAME:
.db 5,"HELLO",0 ;5 means program, 0 terminates
If you want to see more complicated code that edits the first byte of the second line:
ld hl,NAME
rst rMOV9TOOP1
bcall(_ChkFindSym)
ret c
ex de,hl
;Just checking to make sure the size isn't zero, otherwise it will edit unknown data
ld c,(hl)
ld a,c
inc hl
or (hl)
ret z
ld b,(hl)
inc hl
;BC is now the size of the program
;HL points to the data
ld a,3Fh ;3Fh is the newline token
cpir ;Search a max of BC bytes at HL for the first instance of A
ret po ;No bytes left in the program
;HL now points to the byte after the start of the second line
;Make sure it isn't another newline. (means Line 2 was empty)
cp (hl)
ret z
ld (hl),30h ;or whatever byte you want
ret
NAME:
.db 5,"HELLO",0