How to get max value from one table and use it to insert into another table?

Add a database query step and use the aggregate functions to find the max value of a column. Add an alias for it:

Then add the insert step and select the alias from the query step: