how to write & create each of Four VMs on each of different resource group?

Hi Guys,
Please let me know if there is somebody help to share .
I would like to know how to write powershell for create each of Four VMs on each of different resource group?
I can`t find out some command for that. Please guide me something.

You will have to use ForEach-Object cmdlet.

Get-Help Foreach-Object -Online

and about Foreach - PowerShell | Microsoft Docs