Thanks for the advise and sharing the links, actually I had been to both the article earlier today.
My issue is slightly ahead of this, maybe I missed to add that in my original description. sorry.
I tried following the instructions and updated the configuration but what happened is, it created two entries in the configuration instead of updating existing one. Thankfully, I had only used commit confirm so revert was easy.
So to summarize,
I would like to remove the existing line
# set system login user testuser authentication encrypted-password "****************************"
and replace it with a statement to
# set system login user testuser authentication load-key-file /root/.ssh/id_rsa.pub
Please advise.