Can any one help on how to set the SharePoint online site List/Library to read only using Power-Shell script?
There's no setting as such but you can give the List or Library unique permissions and set all groups/users to have only Read permissions to the list.
Here is an article that describes how to do this using PowerShell:
You can use Set-PnPListPermission to remove and add users/groups permissions.
Two blogs for your reference: