Do beam supporting posts need to line up from basement to roof
The posts do not have to line up- structures can certainly be designed and engineered that way.
Is this OK for your project ? There is no way that anyone here can make that judgement with the information you have given. There are many other structural considerations when thinking of replacing a bearing wall with a beam (load, uplift, lateral forces, etc).
I am guessing you would like someone here to say that it will be just fine- and it very well might be OK.
This is something you need to be sure of. It is really worth the time and money to have a proper evaluation done by a qualified engineer familiar with your local regulations.