I would change the whole sentence because it really doesn't sound very good at all. How about:
J'aime beaucoup l'histoire qu'elle a écrite.
The problem with:
Il y a une histoire qu'elle a écrite que j'aime beaucoup.
is that the repeated "qu" sound awful. I think it would be corrected in primary school in France. Another problem is that it is too convoluted. Better to keep it more direct.
If you really wanted to insist, in this kind of context, you could salvage the "il y a une histoire" thus:
Elle a écrit beaucoup de choses. Mais il y a une de ses histoires en particulier que j'aime beaucoup.
Or maybe:
Elle a écrit beaucoup de choses. Mais il y a une de ses histoires qui me plait particulièrement.
I know this side-steps your original question but IMHO, those two "qu'" need fixing first.
In terms of agreement, since this is using the verb "avoir" and that the object complement is before the verb, the agreement would be qu'elle a écrite. Another example:
Les fleurs qu'ils ont cueillies étaient ravissantes.