Welcome to our community and thank you for your question.
It's true that it might be risky to hand in your passport at Standesamt. If your asylum procedure ended with a negative result they know that you have a valid passport and might inform Ausländerbehörde about that (but it doesn't necessarily need to happen). In case they get informed, it enables them to deport you.
However, you will not get deported back to India if your case has not been decided yet. You have an Aufenthaltsgestattung that allows you to stay for the duration of your procedure.
You can marry your girlfriend. But it will neither change your legal status nor grant you a residence permit directly. That would happen if she was a German or EU citizen. In your case, however, you two can stay together in Germany through family reunion after your marriage.
Keep in mind that there might be stricter requirements to fulfill in that case. Only if your girlfriend applies for family reunion within the first three months after getting a positive result by BAMF she doesn't have to prove that she has enough living space and income to enable your stay. Since marriage usually takes a while she will most likely not be abled to apply for it within three months. After that deadline the embassy in your home country has to decide on its own if they still allow reunion without these requirements or not.