Rewrote my_write to use the buffer in order to save sys calls