I have a baked chocolate ring cake, but I want to convert it to a square cake. How I can do it?
Well, if you find a square pan with approximately the same surface area as the round pan, then you can just bake it for the same amount of time at the same temperature. The same surface are is important, since we want the cake to still have the same height as the original.
For some algebra: We can't construct this pan with a compass and a straight edge, but we can approximate it with a calculator. The area of the round pan is pi * r^2, where r is the radius. So a 9-inch round pan would have area pi*4.5^2. We want a square pan with side length s, so we want s^2=pi * r^2. Hence, s=\sqrt(pi * r^2). So for example if you would normally bake it in a 9 inch pan, you would need a square pan with side length approximately \sqrt(pi * 4.5^2) = 8 inches.
Cake is very easy to cut to shape, although you cannot reuse the cut-off pieces to somehow remodel the thing. So, to get your square shape, you will have to cut off enough of the sides of the cake to make it square. This obviously means that the cake will be much smaller - there is nothing you can do to fix this.
The second problem you have is the hole in the middle of your ring-shaped cake. You have to do something so it appears to be there intentionally. Options would be to make a pi~nata cake, or to fill it with some substance firm enough to stand up on its own, and tasty enough when eaten in spoonfuls. You have tons of possibilities, pretty much any firm cake filling mass will do. Looking up no-bake cheesecake recipes would be the easiest place to start. Or you may be able to wing it and reuse your scrap cake if you crumble it and mix it with your filler. If that's too much work, you can decorate it on the plate to make it appear intentional, placing some inedible centerpiece in the hole (a vase of flowers?).
Third, your sides will now be obviously cut, which is undesirable when serving a cake. So you will have to frost the cake, or at least the sides. Don't worry if it is already frosted on top, as long as it isn't decorated, you can place a second frosting of the same or a different kind on top.
All of the above is doable, but a lot of effort and requires full reengineering of the type of cake. Most bakers will not do it, and either serve the cake as a ring, or bake a new cake in a square pan.