Your Attribute settings should work; there should automatically be a gradient between black Vertices and white Vertices.
If you’d use the Face Corner Domain, and use Face Selection Masking, you could create a sharp separation from black to white.
Can you share a screenshot, please?