Hi Paul, sorry, I got it this time.
I changed the code a bit to include the filename, after specifying the new directory where I want the file to be copied to. After adding the filename to it, it worked beautifully!! New line of code now:
($file->copy_content_to($CFG->dataroot . '/peerassessments/' . $peerassessment->id . '/' . $student->id.'/'.$file->get_filename())
Thank you for the help!