Welcome to this forum
Do I understand correctly that you want to dissolve the flame, but the contour should remain? If so, you can use a Lerp (linear interpolation) node to mask the edge. Black for input A, white for input B.
I can't give an example right now. But I'll prepare one later.
It helps us if you can send a screenshot of the diagram. Then we can help you more efficiently.