I want to add comments to the task which belongs to case not to the process.
That’s currently not possible. The CmmnTaskService does not have addComment like the bpmn counterpart has. The reason why it hasn’t been ported is because the comment feature isn’t used that much and the implementation isn’t on par with the rest of the engine (e.g. the comment is always created in the historical tables, which doesn’t follow the typical Flowable paradigm).