If you are programming in BASIC, you use the SAVE command to save a file to a device.
Saving a Program to Cassette
SAVE
Will write to a datasette (cassette recorder)
SAVE “FILENAME”,1
Will write to a datasette with a filename.
Saving a Program to Floppy Disk
SAVE “FILENAME”,8
Will save it to the 1541 drive, assuming it is the primary disk drive. Replace with ,9 for the secondary disk drive (or ,10 or ,11 for the 3rd and 4th drives)