I found a recipe on the internet in which half a cup of ground flax seeds are added to the mixture to make muffins.
Since there is flour and sugar in it I was wondering if that defeats the purpose of using flax seeds to increase your fiber intake.
A survey paper concluded, "Heating generally changes the ratio soluble to insoluble fibre." Both forms are good additions to your diet. The way the ratio change varies from source to source, and the paper does not specify what happens to flax seeds in particular. But flax seeds are well supplied with both kinds of fiber, and unless you have some extreme requirement for one form or the other you'll get sufficient health benefits from consuming them either raw or cooked. (And if you do have extreme requirements you need a doctor's and dietician's advice on your diet.)
This site is not for nutritional advice, so I can't really address the rest of the question, except to note that the form in which you consume the different ingredients doesn't radically alter the nutritional properties. So eating X sugar and Y flour and Z flaxseeds doesn't undo anything; it just adds those amounts of nutritional components to your diet.
I'm guessing the flax seeds are used as a substitute for eggs. Does the recipe ask for eggs? You'll be still eating flax seeds, hence ingesting fiber. But I don't think it's the primal goal in this recipe.