As mentioned in the official Azure Cosmos DB Gremlin API documentation, transactions are unfortunately not supported. Cosmos DB docs stating transactions aren't supported
See link below for reference:
https://learn.microsoft.com/en-us/azure/cosmos-db/gremlin/support?source=recommendations#unsupported-features