"Of course I did not tell him."
当然我没有告诉他 is not good ?
"我当然没有告诉他“is the most natural way of saying it.
I do see "当然我没有告诉他"being correct, but in specific situation in conversation: 当然（raise you voice, slight pause, then) 我没有告诉他, in this way 当然 emphasizes on "I cant believe you thought otherwise". It could be the course moderator simply opt for the more common option here.
But why is there another exercise with 当然 at the beginning? It's just confusing for learners if sometimes it's in the beginning even in the given sentence, and then in another exercise it's not accepted.