Have you got your question resolved?
You can debug your code by echoing the content of your variables and calling die function to see the echo.
for example use this to see what's the comment field returns and if it has content already missing or not:
echo $hook->getValue('comment');die();
If your content is missing after first quotation mark in the echo, then the hook is not getting the value properly from the form and you must look closer at Formit and how it parses your content before sending it to your hook.
If the content is ok in the echo, you can try adding slashes to it when setting it to the resource.
$resource->setContent(addslashes($hook->getValue('comment')));