Adapt to your own situation this example:
Assume that your BASIC program begins with line number 10 and ends with line number 30000. Add these lines to the beginning of the program:
1 PRINT CHR$(4);"OPEN TEXTFILE"
2 PRINT CHR$(4);"WRITE TEXTFILE"
3 LIST 10-30000
4 PRINT CHR$(4);"CLOSE"
5 END
Save the program with the new lines added, then run the program.
This will work in DOS 3.3 or ProDOS, so long as either was used to boot the disk, and so long as there is disk space available to write the program file.
If your program has used lines 1-5, put the new lines at the end, as lines 30001-5 for example, and then type RUN 30001.