The problem got solved and actually client.complete() is enough to complete any task and that internally calls the completeworkitem().
When the process engine is restarted and in resuming an interrupted process, we have to use completeworkitem() on the task thats last completed.
This will continue the process execution.