How to pass dynamic value of Ansible variable to Shell script variable and vice versa.

Can anyone please help me for syntax or logic.

Thanks in advance.