In principle, yes, that's a viable plan. But there are a few stumbling blocks to be aware of.
First: There are two types of MS degrees in computer science in the US. Research master's degrees have a significant research component, usually ending with a formal thesis. Professional master's degrees require only taking classes; this is no expectation and little opportunity to get involved in research. A successful research MS is good preparation for a PhD program, and many CS PhDs started by getting a master's degree first. (I'm one of them.) But a professional MS is generally considered a terminal degree, even with a 4.0 GPA.
Second: PhD applicants with MS degrees are held to higher standards than PhD applicants with only undergraduate degrees, because they have had an extra year to build up a research portfolio. In my department, for example, strong applicants with master's degrees but no formal publications are usually rejected. See the previous point.
Third: Strong graduate programs in the US also get too many applicants for too few positions. Competition at the top departments is fierce. Even getting a research MS is no guarantee of being admitted to a PhD program.
To address the first three points, I strongly recommend asking the following question of any MS program you apply to:
What fraction of graduates from your program go on to get a PhD?
Fourth: If you don't have any research experience, how do you know that you want a PhD? Getting a PhD is not like getting an undergraduate degree; doing research is not like taking classes — it is much more open-ended, much more self-directed, and much much riskier. This is not a question to answer here, but definitely something to address in your application statement.