I am preparing the code for a paper which already published (without my name on it). The code is about to release now and I was hoping to add that to my google scholar or something to keep a record of the citation. Should I put the papar in my google scholar and somehow mention I worked on the code?
No, your name is not on the paper so you should not include it on a list of your publications. You can, of course, list it as an achievement/project/experience on your CV/Website/ORCID/whatever.
If you think your name should have been on the paper and you were not consulted prior to submission, you can inform the journal. This will be a quick way to make enemies of your not-quite-co-authors, however.
You can make your code "citable" (scare quotes because "citable" is being used to mean creating a version of record and a DOI for it, rather than merely being allowed to cite it). There are various repositories which will allow you to get a DOI for non-publication work, here are some examples:
- GitHub/Zenodo - integrates directly with GitHub
- Figshare - not just for figures, despite the name
- Mendeley data - owned by Elsevier, so perhaps can have reasonable confidence in its staying power
Another option is the MethodsX journal, although you'd have to check that your work is suitable for the journal and not going to constitute double-publication. As this is a peer-reviewed journal, it gives you a higher level of "credit" than the other options above. Note, there is a mandatory open-access charge with this journal. (Or, even, if your code is distinct enough from the paper, you could look at publishing a full paper of your own in an appropriate journal; there are lots of software/code papers, even in non-CS fields.)
As you wish for the code to appear on your Google Scholar profile, you will probably need to choose MethodsX (or another Journal) as Google Scholar only indexes article-type documents. You could manually add the others to your publication list as an "other" type publication, but you won't the full suite of scholar features (citation monitoring etc.) that way.
Finally, unless the code is entirely your own work, any of the above will require communication with, consent from and credit to your collaborators (presumably those who published the paper you weren't on).