It seems that the problem here is that you have only one coordinate space, a fusion between the world space and the object space. Scaling your object impacts its position because the coordinate space where the scaling occurs isn't centered on the origin object.
To fix this issue, you need to have two different coordinate spaces: the object space, and the world space. You set the vector of your object in its own object space, around its point of irigin, which is the one you will scale, and then you use the world space to put the object at the right position.
You need to represent your object in its own coordinate space :
X Y Z
a: 0.0 -0.5 0.0
b: 1.0 0.5 0.0
c: -1.0 0.5 0.0
Here, a triangle centered around the origin point
Then, you transform the object space with a scale matrix, let's say with twice the size in both X and Y. You do that by multiplying a scaling matrix, just like you did in your code. You get :
X Y Z
a: 0.0 -1.0 0.0
b: 2.0 1.0 0.0
c: -2.0 1.0 0.0
And finally, you transform the object-space coordinate system to a world-space coordinate system by multiplying with an object-to-world matrix. In this case, this matrix would be a translation matrix, given that you don't want your object to be at the origin point of the screen. Let's say you want the center of this object to be at
(10.0; 20.0; 0.0). With the translation applied, you get :
X Y Z
a: 10.0 9.0 0.0
b: 12.0 11.0 0.0
c: 8.0 11.0 0.0
As you can see, the position of the object isn't impacted by the scale anymore. You can change the scaling ratio of the object without impacting its position in the world.