The ALBEDO variable in the fragment shader is the output color per pixel.
Right now it's set to a mix of object_color and mask_color, which both seems to be fixed colors.
If the shader is running in a secondary pass, after the textured material, I believe you can do something like this to keep the existing color:
ALBEDO = mix(ALBEDO, mask_color.rgb, mask_value);
If you need to include a texture in the shader, add 'uniform sampler2D texture;' somewhere among the other uniform's. This will add a texture shader parameter.
To read the texture, add 'vec4 texture_color = texture(texture, UV);' somwhere in the fragment shader, and finally change the ALBEDO to mix with the texture color.
uniform sampler2D texture;
void fragment() {
// ...
vec4 texture_color = texture(texture, UV);
ALBEDO = mix(texture_color.rgb, mask_color.rgb, mask_value);
}