If you find yourself saying something like the title of this post, take a deep breath and relax. Do that BEFORE you reach for the keyboard and BEFORE you start typing.
Yes, there are some pretty smart people on this forum. But even so, they/we are not magicians or wizards or gods. We can’t see your code. We can’t see your errors…
Remember: We don’t even know what your application is meant to do even though it might seem perfectly obvious to you.
So relax. Follow the advice below and take…

Hi mate, apologies for not providing details on the “doesn’t do the trick” part. Anyway, your code is similar to what I did in using GlobalVariables. The stup*d thing is that I didn’t do proper debug and checking that the actual value from the API (Response body) is passed into @BeforeTestCase.
The passing of value from @BeforeTestCase to @AfterTestCase works using GlobalVariables.

Thanks anyway for spending time responding to my query and happy holidays.