main functionality of vfs_write implemented
implement main write functionality