I have 2 scripts that I created with the help of phind because I don't understand programming. (powershell se)

First script extract all .ass subs and convert them to .srt subs.

Code:
$path = Read-Host "Insira o caminho dos arquivos .mkv"

$mkvFiles = Get-ChildItem -Path $path -Filter *.mkv

foreach ($file in $mkvFiles) {
   $assFileName = Join-Path -Path $path -ChildPath ($file.BaseName + ".ass")

   & 'ffmpeg' -y -i $file.FullName -map 0:s:0 -c copy $assFileName
}

$assFiles = Get-ChildItem -Path $path -Filter *.ass

foreach ($file in $assFiles) {
   $srtFileName = Join-Path -Path $path -ChildPath ($file.BaseName + ".srt")

   & 'ffmpeg' -y -i $file.FullName -f srt $srtFileName
}
Every day I need to convert .ass subtitles to .srt in a standard size that can be read and mux them all in the same .mkv file
and delete all old .ass subtitles from this file

The problem is that the first script that extracts the subtitle is only working for the first subtitle and not all of them. The script should be able to identify all subtitles and do the same extract and convert process for all of them. I would also like the script to make the subtitles larger in standard size, because when converting the subtitles they become really tiny.

The second script should mux all the already converted subtitles into a copy of the .mkv file in case I need a backup and remove the old .ass subtitles, leaving only the new .srt ones. But it's not doing everything either, it's just muxing without deleting the old ones (.ass files).

Code:
$path = Read-Host "Insira o caminho dos arquivos .mkv"

$mkvFiles = Get-ChildItem -Path $path -Filter *.mkv

foreach ($file in $mkvFiles) {
  $srtFileName = Join-Path -Path $path -ChildPath ($file.BaseName + ".srt")

  $outputFileName = Join-Path -Path $path -ChildPath ("new_" + $file.Name)

  & 'mkvmerge' -o $outputFileName --default-track 0:yes --language 0:eng $file.FullName $srtFileName
}
Is there a way to fix it and make it work in a loop with all the videos in the folder? Automating this process would help me a lot. It's really tiring to do all this manually.


Would it also be possible to run both scripts at once or do I need to do it in parts?

Please understand that I'm new to programming, I'm just looking for a way to automate this process.