Usually, people with good marks in grammar test should be able to apply grammars correctly in their writings.
Writing is different from doing problems in exams. In exams, the focus is to solve the problems correctly, and especially through enough practice, some people can develop immediate responses to the stimuli. In order words, some people know the correct answers immediately upon seeing the problem.
Writing is much more demanding than working on exams. In writing, there are many things to take care of, such as organization of paragraphs and the article, choosing words, providing evidences and drawing conclusions, etc.
Nevertheless, I would say that if proper attention is paid to grammar, people, who have a good basis in grammar, without doubt, should be able to apply grammars correctly in writing.