I did not have the heart to refuse to it.
My heart could no longer refuse to it.
I would like to know whether the above sentences are correct or not.
Do they have the same meaning?
Yes, but the way "heart" is being used is not exactly the same.
"I didn't have the heart to..." is an idiom that means I was unable to be cruel or cold or stoic or heartless enough do something -- my emotions or conscience wouldn't let me. It's a specific idiom. "Heart" in this sense means "will", and you will notice that it literally means the opposite of what "heart" usually implies (gentleness, emotion, affection, etc.). Notice that you almost always have to negate it to mean something positive.
"My heart could no longer..." is a poetic way of saying that your emotions kept you from doing something.
So the two sentences end up meaning the same thing, but through different routes. I hope that's not too confusing!
By the way, you need to drop the word "to" in both sentences:
"I did not have the heart to refuse it."
"My heart could no longer refuse it."
You can "refuse to (verb)" as in "refuse to kill" or "refuse to tell", but you cannot "refuse to (object/noun/pronoun)" -- it's simply "refuse (object)" as in "I refused water" or "I refused her offer of a loan".