Both were passed to keep people quiet
The Espionage Act was passed to keep people from interfering with the military's attempt to defeat Germany, the point was to make it so that individuals could not publicly speak out or publish opinions on the topic.
The Sedition Act was passed to keep people from speaking out about the president or the US government