I found a solution that doesn't seem right, but it works.
I created a model that has only one gdal algorithm.
I created a second model that has only the first model.
So I converted the second model to script, and got the result below, where the output file respects the name assigned in the first model, in this case "raster out".
As a partial solution I saved the template script with the desired output name and put it as the last step of my main script.
So I did not join parts of scripts, but whole scripts. However, the result was as expected, the output file is displayed with the name I assigned.