Tunnels

Hi! Recently I have started working on my datapack which has structures which are built by Herobrine. During my testing I have noticed that 2x2 tunnels couldn't spawn normally. Instead of spawning right inside of the hills and mountains, they were spawning only near them, or under the ground, or under the water. I think there are some troubles with my code, so I hope you'll help me with it Thank you. Here's my code:
Continue to help post