This is an example datapack containing everything you need to generate basic jigsaw block structures in your Minecraft world. I would not advise assuming this is the only way to get it to work or even the most effecient way to get things to work, however I do believe the approach is very simple which can help with picking it up.
A very useful online tool is the Data Pack Generator site. I have included several short Shortcut links to parts of that website showing how you can get the same result that appears in this pack.
Another useful guide is this one by GentlemanRevvnar. Some minor aspects of it may be outdated as individual files associated with structure generation have changed format overtime.