I know the verse but it does not make it clear why. All it says is Cain didn't do "right". How did he do "Wrong"? How to do it "right"?
Heb 11:4
By faith Abel offered unto God a more excellent sacrifice than Cain, by which he obtained witness that he was righteous, God testifying of his gifts: and by it he being dead yet speaketh.
Abel's sacrifice was accepted because it was offered "by faith," and I will seek to briefly explain to you exactly what that means.
1Pe 1:18
Forasmuch as ye know that ye were not redeemed with corruptible things,
as silver and gold, from your vain conversation
received by tradition from your fathers;
1Pe 1:19
But with the precious blood of Christ, as of a lamb without blemish and without spot:
1Pe 1:20
Who verily was foreordained before the foundation of the world, but was manifest in these last times for you,
1Pe 1:21
Who by him do believe in God, that raised him up from the dead, and gave him glory; that your faith and hope might be in God.
When it comes to our redemption, or when it comes to the price that God had to pay to purchase us back unto himself, that price was "the precious blood of Christ, as of a lamb without blemish and without spot: who verily was foreordained before the foundation of the world." In other words, God, in his foreknowledge, knew that Adam and Eve would sin before the world was ever created, and he already had a plan of redemption established before sin ever entered into this world.
When Adam and Eve sinned, they sought to cover their nakedness with fig leaves, but God had a totally different covering in mind.
Gen 3:21
Unto Adam also and to his wife did the LORD God make coats of skins, and clothed them.
In order for God to provide coats of skins for Adam and Eve, at least one animal had to be slain, and the killing of that animal foreshadowed the crucifixion of Jesus Christ. Furthermore, when God addressed the serpent in the garden of Eden, this is what he said to him.
Gen 3:15
And I will put enmity between thee and the woman, and between thy seed and her seed; it shall bruise thy head, and thou shalt bruise his heel.
In theological terms, this is commonly called "the protoevangelium" which simply means "the first gospel proclamation." In other words, when God told the serpent (Satan) that he would bruise his heel, the "his" is Christ, and Satan accomplished this when Christ was crucified. Similarly, when God told the serpent (Satan) that "it shall bruise thy head," he was foretelling how Jesus would actually defeat Satan via his crucifixion or atoning sacrifice in that Christ would redeem us from our sins, and deliver us from Satan's power, by what he accomplished through his atoning sacrifice.
Somehow, whether directly from God himself, whether from Adam and Eve, or whether from an angel, this information got passed along to Cain and Abel. With this information before us, let us look at God's conversation with Cain.
Gen 4:1
And Adam knew Eve his wife; and she conceived, and bare Cain, and said, I have gotten a man from the LORD.
Gen 4:2
And she again bare his brother Abel. And Abel was a keeper of sheep, but Cain was a tiller of the ground.
Gen 4:3
And in process of time it came to pass, that Cain brought of the fruit of the ground an offering unto the LORD.
Gen 4:4
And Abel, he also brought of the firstlings of his flock and of the fat thereof. And the LORD had respect unto Abel and to his offering:
Gen 4:5
But unto Cain and to his offering he had not respect. And Cain was very wroth, and his countenance fell.
Gen 4:6
And the LORD said unto Cain, Why art thou wroth? and why is thy countenance fallen?
Gen 4:7
If thou doest well, shalt thou not be accepted? and if thou doest not well, sin lieth at the door. And unto thee
shall be his desire, and thou shalt rule over him.
By asking Cain "If thou doest well, shalt thou not be accepted?," we can know, of a certainty, that Cain understood what the acceptable type of sacrifice was. Abel's sacrifice was the firstlings of his flock, and his offering not only foreshadowed the eventual crucifixion of Jesus Christ who is "the Lamb of God which takes away the sin of the world" (John 1:29), but it was offered "by faith" (Hebrews 11:4) in the same.
Cain's sacrifice was not the type of sacrifice which God had ordained, in that it did not foreshadow Christ's atoning sacrifice, and, therefore, it was rejected by God.
How does any of this pertain to you?
In order for you to be acceptable in God's eyes, you need to place your saving faith in Jesus Christ's sacrificial death, burial, resurrection from the dead, ascension back to heaven, and glorification. This is the price that Christ paid to redeem you, or this is the price God desires to purchase you with.
I hope that you understand what I am saying. If not, then please feel free to ask more questions.
Rom 10:6
But the righteousness which is of faith speaketh on this wise, Say not in thine heart, Who shall ascend into heaven? (that is, to bring Christ down
from above)
Rom 10:7
Or, Who shall descend into the deep? (that is, to bring up Christ again from the dead)
Rom 10:8
But what saith it? The word is nigh thee,
even in thy mouth, and in thy heart: that is, the word of faith, which we preach;
Rom 10:9
That if thou shalt confess with thy mouth the Lord Jesus, and shalt believe in thine heart that God hath raised him from the dead, thou shalt be saved.
Rom 10:10
For with the heart man believeth unto righteousness; and with the mouth confession is made unto salvation.
Rom 10:11
For the scripture saith, Whosoever believeth on him shall not be ashamed.
Rom 10:12
For there is no difference between the Jew and the Greek: for the same Lord over all is rich unto all that call upon him.
Rom 10:13
For whosoever shall call upon the name of the Lord shall be saved.