Hi Asad,
You should:
1) Create a process variable for the user/group name.
2) In the previous node, map the variable output with the user/group to the process variable you defined in 1)
3) In the human task node, define the ActorId or GroupId variable in input parameters to use the variable created in 1), which was filled in 2)
You can make this by user "Parameter Mapping" in eclipse, of, if you need some complex expression, you can directly use an expresion in the groupId variable, such as #{group}.
You can see a simple example in which the groupId is taken from a process variable input:
https://github.com/calcacuervo/JBPM5-Samples/blob/master/human-tasks/src/test/resources/dynamic-user-human-task-test.bpmn
And the test is inside
https://github.com/calcacuervo/JBPM5-Samples/blob/master/human-tasks/src/test/java/com/test/HumanTaskTest.java
Search for the test dynamicUser()
Regards,
Demian