How to combine two code sections?

It’s here

image