I was trying to overwrite the value of "shipping session" like this:
if ($_SESSION['shipping']['id'] == "my_del_calc") {
$_SESSION['shipping']['cost'] = $my_delivery;
}

I put the above piece of code in the file: includes/modules/pages/checkout_shipping/header_php.php

When I do print_r($_SESSION['shipping']) on that same page, it showed the value successfully changed but when I go to next page, value for $_SESSION['shipping']['cost'] goes back to initial value.

I would like to find out where exactly does the value for $_SESSION['shipping'] get assigned first (on which page).

If you know, please let me know.