First of all, I do not recommend that you directly copy the token in Graph explorer. The token is obtained through your username/password when you log in to the Graph explorer tool. It will expire in a period of time and cannot be refreshed yet, you can only log in to Graph explorer again to get a new token when the token expires.
And I think that putting the token directly in the script is inherently a certain security problem. So, from the perspective of security and versatility, I suggest you contact your administrator to create an application in the Azure portal, and then use auth code flow in the script to obtain the access token and refresh token.