First we linearize both files so one read (consisting of four lines) is written as a 4-column tab-separated file and pasted together with the second file, resulting in a 8-column file which we now can easily query with awk. awk then simply prints the first line of the read, then prints the merged read, then the +, then the merged quality. Eventually we collapse from tab-separated format back to newline-separated fastq format. Since there was a whitespace in the header which sometimes might mess up formatting I initially replaced this with a double-underscore as unique delimiter, and then eventually converted this back to whitespace.
Technically possible, yes, may I ask though why you want to do this since there might influence the method how to do it.
file1 is the UMIs fastq file separated from the file2 that is the actual read, I need to put them together again
I see, please see my answer below.