The problem arises when I scan a printed document and save the scan data as either pdf or docx into my computer. When I enter such files, they cannot be edited.

Question has all the details.

Your question has none of the details to allow anyone here to help you.

See the Ask/Getting Started wiki page, particularly the Give key details section.

You need an Optical Character Recognition (OCR) program to recognise the images of the characters and convert it to text.

If your scanner driver offers .docx as an option then your scanner will have come with OCR. You will need to read your scanner manual to find out how to set up scanning to OCR.

You can instead upload the scan to an OCR website.

Either way, you are best to get just the plain text and style it yourself. The layout styles of OCR programs can be difficult to work with and harder to fix

  1. Learn to ask good questions.
  2. From your description that, yes, lacks many necessary detail, one can guess that you get a ‘dead’ PDF file, i. e. a file made of scanned images only. To edit, you need an image editing program such as Gimp (there is no equivalent in LibreOffice). Or see Earnest AI’s comment.