I'm pretty sure that the form Боже would be more correct here than Бог, because you're addressing God directly (as in Боже мой, "Oh my God!").

Otherwise, the translation looks basically correct to me, at least as far as the grammar goes. I'm not 100% sure about the word choices -- but I'm neither a native speaker nor православный (Eastern Orthodox Christian).

From Googling, however, I found several wording variations on this basic formula.

For example, in place of "прости меня", you can say "помилуй меня".

Помилуй is the imperative form of the verb помиловать -- which also means "forgive; pardon", but it often has the implication of a legal pardon or clemency for a convicted criminal. And помиловать is sometimes used proverbially in contrast to казнить ("to execute; to give the death penalty to"). So, using it in a prayer like this serves to emphasize that you DESERVE a harsh punishment -- perhaps even the death penalty (казнь) -- but you are throwing yourself at the mercy of the Supreme Judge.

Alternatively, you could begin with the phrase "Благослови меня", which means "Bless me" rather than "Forgive me."

Instead of Боже, you could use Господи ("Oh Lord!"). Also, sometimes Бог/Боже is replaced with отче -- an old-fashioned form of отец, "father." I would assume that if the word is capitalized as Отче, the understood meaning will be "God the Father", but if it's lower-case (отче) then it will be understood as a title of address for the священник (priest) who is hearing a confession.

Finally, the last part ибо я согрешил does seem to be highly standardized -- the only variation is that a woman would, of course, use the feminine form согрешила.

But anyway, you should definitely consult with the native speakers here about which variant sounds the most natural/traditional -- I'm just offering some alternatives that I found with Google.