I was finally able to complete XX after much trial and error.
After many failed attempts, I was finally able to make XX.
この場合、次のような言い方ができますよ。
ーI was finally able to complete XX after much trial and error.
「試行錯誤をしてやっとXXを作ることができた」
after much trial and error で「試行錯誤して」
ーAfter many failed attempts, I was finally able to make XX.
「試行錯誤して、やっとXXを作れた」
after many failed attempts で「試行錯誤して」を表現することもできます。
ご参考まで!