Populating an input with another input

How do I populate a input which I use for searching with another search input which appears on mobile (when current page width < some number). I tried to explain it as good as I can with these photos:

This is my normal input which I use for searches. After a user types something and presses enter or the search icon it goes to my search page and filters the results through URL parameter and after it does that, the input value continues to be whatever the user typed in; which is a normal search input behaviour and thats great. But next few pics is where I run into a problem.
When its on mobile or tablet, my header shows this hamburger icon which when expanded shows a new input search field inside the mobile menu:

After I perform a search with this input field and if the previous one (step 1 input) has already been used (a search was made using that input), my app does the correct search and gives out the correct filtering, but the step 1 input value stays what it was before:
step 3

I hope i explained it well. P.S. I tried using set initial content to be of URL parameter value but it does not overwrite if the user already typed something in the step 1 input field.

Anyone knows how to make that if step 2 field was used that the step 1 field holds that value after performing the according “search” workflow?