"Whoever comes with a good deed" meaning: there is no god but Allah, "then for him is better than it" meaning: for him, because of it, is something better. "And whoever comes with an evil deed" meaning: with shirk (polytheism), "those who do evil deeds shall be recompensed only for what they used to do," he says: their recompense is the Fire, abiding therein forever.
﴿من جَاءَ بِالْحَسَنَة﴾ لَا إِلَهَ إِلَّا اللَّهُ ﴿فَلَهُ خير مِنْهَا﴾ أَيْ: فَلَهُ مِنْهَا خَيْرٌ. ﴿وَمَنْ جَاءَ بِالسَّيِّئَةِ﴾ بِالشِّرْكِ ﴿فَلا يُجْزَى الَّذِينَ عَمِلُوا السَّيِّئَاتِ إِلا مَا كَانُوا يَعْمَلُونَ﴾ يَقُولُ: جَزَاؤُهُمُ النَّارُ خَالِدِينَ فِيهَا.