def hello():
    return """
        <html><body>
        Hello. <a href="/getPlotCSV">Click me.</a>
        </body></html>
        """

@app.route('/getPlotCSV')
def getPlotCSV():
    csv = '1,2,3\n4,5,6\n'
Flask: Download a csv file on clicking a button