Its not a contradiction, you have to take every verse in the context of the whole book and not alone. God says he will forgive those who commit shirk if they stop and become believers, so when God says he does not forgive shirk, it is obviously within the context of this, God does not forgive shirk at Judgement day, God does if the person gives it up.