You can form a GRanges object from the vector of chromosome names and the vector of locations, same as you input to nearestTSS. The help page you link to gives an example of how to do that. I'm not familiar with get2NearestFeature though so can't help you with it.
Regarding nearestTSS, please be aware that it only works with hg38, not with hg19, so you should not use it at all in your analysis.
Is there a reason for using hg19, since hg38 was released nearly a decade ago?
Thx a lot for your reply. This project was handed to me with the bismark results already using hg19.
I did everything from the beginning using hg38. I will try now to use get2NearestFeature. I will let you know how it works if a manage to do it successfully.