Using insertReference() to populate reference field by catching data of a dynamic page

I have a custom booking form on this dynamic page named ‘RentalCars(URL)’. The booking form connects with a table (RentalCarBooking), which has a reference field (bookingRef). The reference field is referenced to the table (RentalCars), upon which the dynamic page is made.
I am here providing the code. Don’t know where I messed up. Everything works fine, only the reference is not inserted to the reference field.