To write to a file, you have to have the correct pathname and the device has to be mounted.
Example: to write a file named "myfile" to partition #2 of drive #1:
The device is most likely sda2. Let's mount it in /mnt (but could be anywhere you like):
mount /dev/sda2 /mnt/abc
Now you can write a file to /mnt/abc