problem with main.mcfunction file in a custom block datapack

I downloaded a datapack from a video and I tried to test it and it didnt work, I knew it was a main.function file problem so I paste all the lines in command blocks and it worked but, ofc thats gonna make lag so I need to see why my main file is not working.
Continue to help post