Here is how my version of the script looks. I went through each necessary step individually, and left any step I didn't follow commented out in the script. Make any changes you need to:
echo What drive would you like to use? Be careful. This tool can be system destroying.
echo (e.g.\; /dev/sda1)
echo CD to /tmp
echo Creating a Directory named \"flash\"
echo CD to /tmp/flash
echo 'Enter file size in Kilobytes (1000000000 = 1TB) : ';read FILESIZE
echo Creating MSDOS File System
mkdosfs -C temp_file $FILESIZE
echo Unmounting $DRIVE
ls -s temp_file
echo Requesting escalation to root \for \write to $DRIVE
head -c 244136K temp_file > $DRIVE
echo Write successful, de-escalating shell
sudo mount $DRIVE /media/joshd
sudo fdisk $DRIVE