Correct, I'm leaving that up to you to figure out.in your usbFunctionWrite, it seems data[0] is the field bmRequestType of the USB device request sent by the host and not the actual data to be transfered after the data stage transaction.
Your problem may be how you set up the pipes. Can you post your config in here?