If you want to export only stored procedures and functions, this is the script you should run
mysqldump --routines --triggers --no-create-info --no-data --no-create-db --skip-opt -u [user] -p [database] > stored-triggers.sql
You can remove any parameter added to fit your expectations. 💪