Fixed the writeRecipe method by adjusting the for loops