The goal is for us to become complete in the perfection of the human form (Ephesians 4:15), the image of God. God is love, so the perfection of the human form is a vessel of God's love. Love is a spirit: an attitude and behaviour, which is distinct from knowledge, because knowledge is understanding and information. So a person is made new in the spirit through the sanctifying grace of God when they decide to receive His judgment and to repent. But although they are therefore redeemed from the slave owner (Romans 7:14, Romans 6:16, Genesis 4:7), their beliefs and customs have not instantly changed (although it is true that The Holy Spirit instantly begins changing their sense of taste, which explains how habits and sexual deviances are broken).
Therefore Romans 12:2 says we should be transformed (into the likeness of Christ) by the renewing of the mind. It says precisely that the mind, when it is new, is godly and that the world would have us conform to it's way of thinking instead. That's why Jesus said that we must become again as a little child - being pure and innocent in thought, having no interest in the depraved conduct that belongs to the realm of the fallen. And it is natural that as we begin to walk in newness of life, we will be inclined to still behave in the pattern of the former habits until The Lord leads us to learn that indeed it is contrary to holiness. That is what distinguishes the ones who walk in the light from the ones who, though having believed some Christian ideas, have not remained in the light.
When James says the quarrels and conflicts come from the flesh putting us at war with one another, he says it is because we desire to have a thing for our own pleasure - and nobody who does the work of God is doing war with their brothers (1 John 3:15), because "love does no harm to a neighbour" and "love does not seek to serve itself" (1 Corinthians 13).
Therefore just as a child may sometimes do a thing that is wrong, yet when it is brought to light by a spirit of love, he confesses and genuinely seeks to learn, thereby growing more righteous through humbleness. I do not say that is sin though, because sin is characterised by obstinence: a determined course of wrongness despite having no excuse. "Whoever knows the good he should do, but does not do it: to him it is sin" (James 4:17).
This is how Hebrews 10:14 says that we are made perfect forever by the one sacrifice: if we are indeed (being of the state of) sanctified.