Can I own an existing install of Logic Pro X from a used Mac?
The app, Logic Pro X in this case but it could be any Mac App Store app, remains tied to the account that purchased it, regardless of the currently authenticated account in the App Store app. Updating the app would require you to enter the Apple ID that purchased the app, and it is not possible to transfer ownership of an app from one Apple ID to another.

If you wish to keep the app, you can copy it to an external drive. The app is still linked to the old Apple ID, but you can use it either from the external drive or by copying it back after you've done whatever you need to do on the internal disk. You'll still not be able to update the app.