Hi new-comer!
You set a global variable instead of a process variable with your code. Global variables are visible for all objects in knowledge session, like process instances. Look at the API for more informations: http://docs.jboss.org/jbpm/v5.3/userguide/ch.core-basics.html#sec.data
If you want to set a process variable with standard bpmn, you can user result mapping of an activity.