I have scheduled a Bash script to run on the 1st of the month but I need to create 2 variables in it with the 1st and last date of the previous month, whatever those may be.
If you're doing this on the 1st day of the month then you can use something like
first=$(date --date='-1 month') last=$(date --date='-1 day')
But if you're running on another date then I guess you'll need to start from a known reference date.