"How can I develop a program to build a solar panel charging and discharging system?"
This community is here to discuss how developers can use App Inventor to work with their projects. Although App Inventor might help you to control your do it yourself solar panel project, the community cannot tell you how to build one.
You might instead search the Internet for do it your self solar panel charging and discharging. If the diy project uses computer control, you might be able to use an api to control your system.
Good luck.