How to pass variable from one request to another and update it every time?

Hi! I’m new here,
How to use data from one GET request and pass it to another POST request? But this data needs to be updated every time if the post-request was successful.
For example:

export default function() {
const headers = {
    'Authorization': `${data.token}`,
    'Content-Type': 'application/json'
group('Customer', function () {
const getVer = http.get(
      { headers },)
      const versionJson = JSON.parse(getVer.body);
    let version = versionJson.result.list[0].version;
    console.log("Version:", version);
    let body = {
"version": version};
response =
      { headers },

When I run test, it passes correct version for the first time, but during the next iterations it passes old version value, but it has to be updated every time when post request uses it successfully.

Not particularly relevant now.