try to think about the execution context of the functions you have.
your add function, which is defined as template helpers is executed in server side context, it does not have access to the DOM, that is why everything you define in template helpers can be called as handlebars helpers.
your sum function, which is defined as javascript function in page is executed in browser side context as a normal browser that loads a page would do. it can not access handlebars helpers, you can modify DOM here because you are in browser side context
remember that jsreport executes your template to get final html (generated by your template body, helpers calls and data), and then uses that html to evaluate it in a recipe which usually is a browser (phantom, chrome), so in that part everything you have as script tags inside your html is evaluated