Setblock at area effect cloud builds block in two locations simultaneously

I have a function : set_position_to_player.mcfunction that saves the position of the player to a scoreboard

execute store result score $x position run data get entity MGengine Pos[0]
execute store result score $y position run data get entity MGengine Pos[1]
execute store result score $z position run data get entity MGengine Pos[2]

I have another function: set_cobble.mcfuntion that sets a cobblestone block at the position of the area effect cloud with tag "temp" if the block it is replacing is air

execute at @s run summon area_effect_cloud ~-10 ~ ~ {Duration: 1, Radius: 0f, Tags: ["temp"]}
execute store result entity @e[type=area_effect_cloud,tag=temp,limit=1] Pos[0] double 1 run scoreboard players get $x position
execute store result entity @e[type=area_effect_cloud,tag=temp,limit=1] Pos[1] double 1 run scoreboard players get $y position
execute store result entity @e[type=area_effect_cloud,tag=temp,limit=1] Pos[2] double 1 run scoreboard players get $z position
execute as @e[type=area_effect_cloud,tag=temp] run execute at @s as @s run execute if block ~ ~ ~ air run setblock ~ ~ ~ cobblestone

I have another function: set_air.mcfuntion that does the exact opposite thing. I just switched air and cobblestone, I also spawn the area_effect_cloud at the player's position instead of 10 blocks away. And a third function: box_tick.mcfunction that happens on tick. It is supposed to create a 3x3 platform underneath the player that moves with the player.

function printer_test:set_position_to_player
scoreboard players remove $y position 1
function printer_test:box/set_cobble
scoreboard players add $x position 1
function printer_test:box/set_cobble
scoreboard players add $z position 1
function printer_test:box/set_cobble
scoreboard players remove $x position 1
function printer_test:box/set_cobble
scoreboard players remove $x position 1
function printer_test:box/set_cobble
scoreboard players remove $z position 1
function printer_test:box/set_cobble
scoreboard players remove $z position 1
function printer_test:box/set_cobble
scoreboard players add $x position 1
function printer_test:box/set_cobble
scoreboard players add $x position 1
function printer_test:box/set_cobble
scoreboard players add $x position 1
function printer_test:box/set_air
scoreboard players add $z position 1
function printer_test:box/set_air
scoreboard players add $z position 1
function printer_test:box/set_air
scoreboard players add $z position 1
function printer_test:box/set_air
scoreboard players remove $x position 1
function printer_test:box/set_air
scoreboard players remove $x position 1
function printer_test:box/set_air
scoreboard players remove $x position 1
function printer_test:box/set_air
scoreboard players remove $x position 1
function printer_test:box/set_air
scoreboard players remove $z position 1
function printer_test:box/set_air
scoreboard players remove $z position 1
function printer_test:box/set_air
scoreboard players remove $z position 1
function printer_test:box/set_air
scoreboard players remove $z position 1
function printer_test:box/set_air
scoreboard players add $x position 1
function printer_test:box/set_air
scoreboard players add $x position 1
function printer_test:box/set_air
scoreboard players add $x position 1
function printer_test:box/set_air
scoreboard players remove $y position 2
function printer_test:box/set_cobble
kill @e[type=area_effect_cloud,tag=temp]

The problem: my setblock functions are placing and checking blocks where the area effect cloud was summoned AND the position of the scoreboard. This results in some weird behaviour, such as a block of cobblestone at the player's position. To exemplify the problem, I have set the area effect cloud to spawn 10 blocks away from the player, and also at the player's position. I've also placed a block of cobblestone 2 blocks under the last air block placed (this line:)

function printer_test:box/set_cobble```
Continue to help post