Present perfect passive voice
Solution 1:
I suspect the question requires only the final clause to be made passive. In that case it would be She took a long time to write the composition, but at last it was written.
Solution 2:
If you really for some reason wanted to put the entire sentence in the passive, then you would end up with:
A long time was taken (by her) to write the composition, but at last it was written.
If you were to passivise the infinitive (though the interpretation doesn't effectively change), then you would also need the specifier "for":
A long time was taken (by her) for the composition to be written, but at last it was written.
If you wanted to include the agent (originally the subject of the active sentence-- "she") then you could insert the "by her" in brackets. But usually the point of using the passive is that the agent isn't mentioned.
Passivising the first part of the sentence is somewhat unnatural (but just about plausible), so Barrie England may well be right that what was intended was for you to passivise only the second part of the sentence.