Configure aws credentials using go

I want to create a go function that modify the .aws/credentials with values i generate from my code, i checked the aws sdk go v2 documentation and managed to create a code that is working but after the run end and i check the credentials file nothing is changed there, can i use this sdk to achive that?( to also modify the file content)

        ctx := context.TODO()
        cfg, err := config.LoadDefaultConfig(ctx, config.WithRegion("eu-central-1"),config.WithSharedConfigProfile("default"),
            Value: aws.Credentials{
                AccessKeyID: "x", SecretAccessKey: "y",
        if err != nil {
          log.Fatalf("failed to load configuration, %v", err)

        client := sts.NewFromConfig(cfg)
    identity, err := client.GetCallerIdentity(ctx, &sts.GetCallerIdentityInput{})
    if err != nil {

    fmt.Printf("Account: %s, Arn: %s", aws.ToString(identity.Account), aws.ToString(identity.Arn))

Package credentials provides types for retrieving credentials from credentials sources.