Welcome to our community and thank you for your question.
First of all we need to know what your legal status is at the moment. You said that you appealed after you've been rejected by BAMF. Has your appeal been decided yet or not?
To answer your other questions: no, of course it's not illegal to have a passport and you are allowed to marry, no matter what your legal status is. But it's always risky to submit your passport to officials if you've been rejected during your asylum procedure or if you have Duldung. Authorities need to have a valid passport that proves your identity in order to deport you. It could be that Standesamt informed Ausländerbehörde/Police about it and that they are now searching for you. But you can't get deported as long as your appeal is still not decided yet. That's why I asked about it.