Hi,
first and foremost, thanks for the message. Finally I see a proper request, stating where you start from and where you want to go.
Second, I'd suggest to not avoid the "pre-made" classes altogether, otherwise you'll end up re-writing everything. The whole ns-3 is a collection of pre-made classes after all.
About your code, I'd not use AnimationInterface::SetConstantPosition. It will work for NetAnim, but it doesn't install a proper mobility helper in the node. This is not an issue for wired topologies, but it is important for wireless ones.
Use SetPositionAllocator and use one of the available allocators. You can use the GridPositionAllocator or the ListPositionAllocator (if your nodes are not on a regular grid, as in your case).
I assume in the following you want to use PointToPoint NetDevices.
After that you have to group the nodes in couples and place the couple in a NodeContainer. You pass the NodeContainer to the PointToPointHelper and it will install a network between the two nodes.
Since you're at it and since the previous operation gave you the newly created devices in a NetDeviceContainer, you may want to just install the proper Internet addresses on them. However, you should have installed the internet stack in the nodes before.
In order to avoid headaches (you can't install Internet on a node twice), do it just after the nodes creation, it's ok.
After all this you should have a grid topology. However there are still one thing: you have to decide (and install) the routing (before installing the Internet on the nodes).
After the routing is set, you'll have a fully functional grid topology.
Hope this helps,
T