Living in Godliness is the fruit of believing in Christ.
These many people may have believed in the existence of Christ, but they did not believe/entrust their spiritual well being to Christ; have faith/reliance upon Christ for salvation. In other words, they do not believe on the Lord Jesus Christ (Acts 16:31) and were not saved.
*Jesus NEVER knew them (Matthew 7:23).*
Notice that Paul said to "work out" your salvation and not "work for" your salvation. When we "work out" at the gym, we exercise to develop our body that we already have and not to get a body. Farmers "work" the land, not in order to get the land, but to develop the land they already have.
The Greek verb rendered "work out" means "to continually work to bring something to completion or fruition." We do this by actively pursuing the process of ongoing sanctification, which is the result of being set apart for God's work and involves the process of being conformed to the image of Christ. This conforming to Christ involves the work of the person, but it is still God working in the believer to produce more of a Godly character and life in the person who has already been justified by faith.
W A Criswell emphasizes that Philippians 2:12-13 "must be read together for a proper understanding. “Work out your own salvation” means to “work out,” not “work for.” A “works salvation” is not being taught. The idea is to progress to the finish or completion in spiritual growth and maturity. This process is what the Bible calls “sanctification.” It should be noted that Phil 2:12 makes it clear we are to be active, not passive, in this process. However, though we are active, we are not alone. Phil 2:13 reminds us again that the entire salvation process is the work of a sovereign God and the result of His grace (Ed: Ministered by the indwelling Holy Spirit).. (Criswell, W A. Believer's Study Bible: New King James Version. 1991. Thomas Nelson)