Can I write my affiliation from as current university though I did my work in my previous university? I want to publish a paper from my previous work, my current university has the access to the journal. I do not want to put any professor as coauthor in my paper. So can I use current university as affiliation?
There are two ways of handling this that I can think of, but regardless, I'm pretty sure your current affiliation should be used for your "official affiliation".
You can include a footnote or some other appropriate comment on the first page that says where the work was done. I did this once when I relocated to a new job while the paper was under review. See Additional information here (which appears without the label "Additional information" at the bottom of the first page of the actual paper).
You can include this information in an Acknowledgments section at the end.
In my case, we simply told our contact editor during the proof stage, after acceptance, that the work was done before a job change, and the journal decided how to handle this. This is surely something that occurs not all that infrequently for the journal (and presumably also for most any journal), so I suspect what they did was in their editors' "style manual" (or whatever passes for one at the journal).
My feeling is that if you include this information in an Acknowledgments section, then you probably don't need to say anything before doing so. If you'd rather not do this in an Acknowledgements section, then because journals often have certain styles for first page information and for footnotes, it's probably best to ask your contact editor, after acceptance, how they wish this to be handled.