Implemented write() system call