Marhaba Ashraf,
Listen , your request is really complicated and you can't do it as you are proposing.
The only thing that came to my mind to have it working is :
1- creat another database (or table) to include two columns (Callid and agentsID)
2- on the primary script , create a variable (type user) and use the select resource step when trasfereing to agent and choose no to connect
3- on the selected tab under the select resource , use connect step and assign the user to that step.
4- open a DB connection and write on the temp database (step 1) the agentID (user created and assigned) and the callid.
5- before the call finished , the agent should transfer the call to a new script , the new scrip should begin with reading the DB based on the caller id , in that step you will get the agentID and assign it to a variable to be used later , also delete the record from the temp database so it can't be used in the future if the same caller called .
Please try it and let me know fi this was helpful.
Amer