How to modify csv database in flask so that data is not overwritten?

Solution
@app.route('/contact', methods=["GET","POST"])
def get_contact():
    form = ContactForm()
    if request.method == 'POST':
        name =  request.form["name"]
        email = request.form["email"]
        message = request.form["message"]
        res = pd.DataFrame({'name':name, 'email':email, 'message':message}, index=[])
        res.to_csv('./contactDatabase.csv', mode='a', header =False)
        return redirect(url_for("rgb"))
    else:
        return render_template('contact.html', form=form)